@@ -21,17 +21,17 @@ fn echo(req: Request<Body>) -> BoxFut {
21
21
22
22
match ( req. method ( ) , req. uri ( ) . path ( ) ) {
23
23
// Serve some instructions at /
24
- ( Method :: GET , "/" ) => {
24
+ ( & Method :: GET , "/" ) => {
25
25
* response. body_mut ( ) = Body :: from ( "Try POSTing data to /echo" ) ;
26
26
}
27
27
28
28
// Simply echo the body back to the client.
29
- ( Method :: POST , "/echo" ) => {
29
+ ( & Method :: POST , "/echo" ) => {
30
30
* response. body_mut ( ) = req. into_body ( ) ;
31
31
}
32
32
33
33
// Convert to uppercase before sending back to client.
34
- ( Method :: POST , "/echo/uppercase" ) => {
34
+ ( & Method :: POST , "/echo/uppercase" ) => {
35
35
let mapping = req. into_body ( ) . map ( |chunk| {
36
36
chunk
37
37
. iter ( )
@@ -48,7 +48,7 @@ fn echo(req: Request<Body>) -> BoxFut {
48
48
// the chunks as they arrive. So, this returns a different
49
49
// future, waiting on concatenating the full body, so that
50
50
// it can be reversed. Only then can we return a `Response`.
51
- ( Method :: POST , "/echo/reversed" ) => {
51
+ ( & Method :: POST , "/echo/reversed" ) => {
52
52
let reversed = req. into_body ( ) . concat2 ( ) . map ( move |chunk| {
53
53
let body = chunk. iter ( ) . rev ( ) . cloned ( ) . collect :: < Vec < u8 > > ( ) ;
54
54
* response. body_mut ( ) = Body :: from ( body) ;
0 commit comments