feat(uri): redesign RequestUri type into Uri

Closes #1000

BREAKING CHANGE: The name of `RequestUri` has changed to `Uri`. It is no
  longer an `enum`, but an opaque struct with getter methods.
This commit is contained in:
Guillaume Gomez
2017-01-14 14:38:21 +01:00
committed by Sean McArthur
parent 1868f8548d
commit 9036443e6b
10 changed files with 297 additions and 136 deletions

View File

@@ -23,12 +23,12 @@ impl Service for Echo {
fn call(&self, req: Request) -> Self::Future {
::futures::finished(match (req.method(), req.path()) {
(&Get, Some("/")) | (&Get, Some("/echo")) => {
(&Get, "/") | (&Get, "/echo") => {
Response::new()
.with_header(ContentLength(INDEX.len() as u64))
.with_body(INDEX)
},
(&Post, Some("/echo")) => {
(&Post, "/echo") => {
let mut res = Response::new();
if let Some(len) = req.headers().get::<ContentLength>() {
res.headers_mut().set(len.clone());