@@ -11,16 +11,18 @@ macro_rules! typed_headers_from_request {
11
11
#[ rocket:: async_trait]
12
12
impl <' r> FromRequest <' r> for $name {
13
13
type Error = headers:: Error ;
14
- async fn from_request( req: & ' r Request <' _>) -> crate :: request:: Outcome <Self , Self :: Error > {
14
+ async fn from_request( req: & ' r Request <' _>) ->
15
+ crate :: request:: Outcome <Self , Self :: Error > {
15
16
req. headers( ) . get( $name:: name( ) . as_str( ) ) . next( ) . or_forward( Status :: NotFound )
16
17
. and_then( |h| HHeaderValue :: from_str( h) . or_error( Status :: BadRequest ) )
17
18
. map_error( |( s, _) | ( s, headers:: Error :: invalid( ) ) )
18
- . and_then( |h| $name:: decode( & mut std:: iter:: once( & h) ) . or_forward( Status :: BadRequest ) )
19
+ . and_then( |h| $name:: decode( & mut std:: iter:: once( & h) )
20
+ . or_forward( Status :: BadRequest ) )
19
21
}
20
22
}
21
23
) * )
22
24
}
23
-
25
+
24
26
macro_rules! generic_typed_headers_from_request {
25
27
( $( $name: ident<$bound: ident>) ,* ) => ( $(
26
28
pub use crate :: http:: $name;
@@ -29,15 +31,17 @@ macro_rules! generic_typed_headers_from_request {
29
31
impl <' r, T1 : ' static + $bound> FromRequest <' r> for $name<T1 > {
30
32
type Error = headers:: Error ;
31
33
async fn from_request( req: & ' r Request <' _>) -> crate :: request:: Outcome <Self , Self :: Error > {
32
- req. headers( ) . get( $name:: <T1 >:: name( ) . as_str( ) ) . next( ) . or_forward( Status :: NotFound )
34
+ req. headers( ) . get( $name:: <T1 >:: name( ) . as_str( ) ) . next( )
35
+ . or_forward( Status :: NotFound )
33
36
. and_then( |h| HHeaderValue :: from_str( h) . or_error( Status :: BadRequest ) )
34
37
. map_error( |( s, _) | ( s, headers:: Error :: invalid( ) ) )
35
- . and_then( |h| $name:: decode( & mut std:: iter:: once( & h) ) . or_forward( Status :: BadRequest ) )
38
+ . and_then( |h| $name:: decode( & mut std:: iter:: once( & h) )
39
+ . or_forward( Status :: BadRequest ) )
36
40
}
37
41
}
38
42
) * )
39
43
}
40
-
44
+
41
45
// The following headers from 'headers' 0.4 are not imported, since they are
42
46
// provided by other Rocket features.
43
47
@@ -100,4 +104,3 @@ generic_typed_headers_from_request! {
100
104
Authorization <Credentials >, // Authorization header, defined in RFC7235
101
105
ProxyAuthorization <Credentials > // Proxy-Authorization header, defined in RFC7235
102
106
}
103
-
0 commit comments