@@ -28,60 +28,26 @@ pub fn box_error<E: Error + Send + 'static>(error: E) -> BoxError {
28
28
}
29
29
30
30
pub trait RequestExt {
31
- /// The request method, such as GET, POST, PUT, DELETE or PATCH
32
- fn method ( & self ) -> & Method ;
33
-
34
- /// The request URI
35
- fn uri ( & self ) -> & Uri ;
36
-
37
31
/// The byte-size of the body, if any
38
32
fn content_length ( & self ) -> Option < u64 > ;
39
33
40
- /// The request's headers, as conduit::Headers.
41
- fn headers ( & self ) -> & HeaderMap ;
42
-
43
34
/// A Reader for the body of the request
44
35
///
45
36
/// # Blocking
46
37
///
47
38
/// The returned value implements the blocking `Read` API and should only
48
39
/// be read from while in a blocking context.
49
40
fn body ( & mut self ) -> & mut dyn Read ;
50
-
51
- /// A readable map of extensions
52
- fn extensions ( & self ) -> & Extensions ;
53
-
54
- /// A mutable map of extensions
55
- fn extensions_mut ( & mut self ) -> & mut Extensions ;
56
41
}
57
42
58
43
impl RequestExt for ConduitRequest {
59
- fn method ( & self ) -> & Method {
60
- self . method ( )
61
- }
62
-
63
- fn uri ( & self ) -> & Uri {
64
- self . uri ( )
65
- }
66
-
67
44
fn content_length ( & self ) -> Option < u64 > {
68
45
Some ( self . body ( ) . get_ref ( ) . len ( ) as u64 )
69
46
}
70
47
71
- fn headers ( & self ) -> & HeaderMap {
72
- self . headers ( )
73
- }
74
-
75
48
fn body ( & mut self ) -> & mut dyn Read {
76
49
self . body_mut ( )
77
50
}
78
-
79
- fn extensions ( & self ) -> & Extensions {
80
- self . extensions ( )
81
- }
82
- fn extensions_mut ( & mut self ) -> & mut Extensions {
83
- self . extensions_mut ( )
84
- }
85
51
}
86
52
87
53
/// A Handler takes a request and returns a response or an error.
0 commit comments