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:
committed by
Sean McArthur
parent
1868f8548d
commit
9036443e6b
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user