nickel-org / nickel.rs

An expressjs inspired web framework for Rust

Home Page:http://nickel-org.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Router cannot match while the HTTP Path is AbsoluteUri

colorhook opened this issue · comments

Add middleware for every request

server.utilize(middleware! { | request |
    println!("logging request from middleware! macro: {:?}", request.origin.uri);
});

Handle a route

server.get('/',  middleware!("Yes, got it!");

start server

let _ = server.listen("127.0.0.1:8080");

visit http://localhost:8080, get corrent response from server, and terminal display:

logging request from middleware! macro: AbsolutePath("/")

But browser got 404 while visiting with a domain(by SwitchyOmega chrome plugin), the HTTP request header begin with:

GET http://xxx.com/ HTTP/1.1

And log middleware output the message:

logging request from middleware! macro: AbsoluteUri("http://xxx.com/")