Don't try to handle fragment in router.

It is strictly a client-side mechanism
This commit is contained in:
Magnus Hoff 2017-10-02 21:35:52 +02:00
parent cdcdf8e72f
commit b21a7ccda4
3 changed files with 3 additions and 3 deletions

View file

@ -77,7 +77,7 @@ impl Service for Site {
let (method, uri, _http_version, _headers, body) = req.deconstruct(); let (method, uri, _http_version, _headers, body) = req.deconstruct();
println!("{} {}", method, uri); println!("{} {}", method, uri);
Box::new(self.root.lookup(uri.path(), uri.query(), None /*uri.fragment()*/) Box::new(self.root.lookup(uri.path(), uri.query())
.and_then(move |resource| match resource { .and_then(move |resource| match resource {
Some(resource) => { Some(resource) => {
use hyper::Method::*; use hyper::Method::*;

View file

@ -5,5 +5,5 @@ pub trait Lookup {
type Error; type Error;
type Future: futures::Future<Item=Option<Self::Resource>, Error=Self::Error>; type Future: futures::Future<Item=Option<Self::Resource>, Error=Self::Error>;
fn lookup(&self, path: &str, query: Option<&str>, fragment: Option<&str>) -> Self::Future; fn lookup(&self, path: &str, query: Option<&str>) -> Self::Future;
} }

View file

@ -59,7 +59,7 @@ impl Lookup for WikiLookup {
type Error = Box<::std::error::Error + Send + Sync>; type Error = Box<::std::error::Error + Send + Sync>;
type Future = Box<Future<Item = Option<Self::Resource>, Error = Self::Error>>; type Future = Box<Future<Item = Option<Self::Resource>, Error = Self::Error>>;
fn lookup(&self, path: &str, query: Option<&str>, _fragment: Option<&str>) -> Self::Future { fn lookup(&self, path: &str, query: Option<&str>) -> Self::Future {
assert!(path.starts_with("/")); assert!(path.starts_with("/"));
if path.starts_with("/_") { if path.starts_with("/_") {