File tree Expand file tree Collapse file tree 5 files changed +8
-7
lines changed Expand file tree Collapse file tree 5 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ impl ServeDir {
22
22
23
23
impl < State > Endpoint < State > for ServeDir {
24
24
fn call < ' a > ( & ' a self , req : Request < State > ) -> BoxFuture < ' a , Result > {
25
- let path = req. uri ( ) . path ( ) ;
25
+ let path = req. url ( ) . path ( ) ;
26
26
let path = path. trim_start_matches ( & self . prefix ) ;
27
27
let path = path. trim_start_matches ( '/' ) ;
28
28
let mut file_path = self . dir . clone ( ) ;
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ impl LogMiddleware {
30
30
ctx : Request < State > ,
31
31
next : Next < ' a , State > ,
32
32
) -> crate :: Result {
33
- let path = ctx. uri ( ) . path ( ) . to_owned ( ) ;
33
+ let path = ctx. url ( ) . path ( ) . to_owned ( ) ;
34
34
let method = ctx. method ( ) . to_string ( ) ;
35
35
log:: info!( "<-- Request received" , {
36
36
method: method,
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ pub struct Request<State> {
29
29
}
30
30
31
31
impl < State > Request < State > {
32
+ /// Create a new `Request`.
32
33
pub ( crate ) fn new (
33
34
state : Arc < State > ,
34
35
req : http_types:: Request ,
@@ -77,15 +78,15 @@ impl<State> Request<State> {
77
78
///
78
79
/// let mut app = tide::new();
79
80
/// app.at("/").get(|req: Request<()>| async move {
80
- /// assert_eq!(req.uri (), &"/".parse::<tide::http::Url>().unwrap());
81
+ /// assert_eq!(req.url (), &"/".parse::<tide::http::Url>().unwrap());
81
82
/// Ok("")
82
83
/// });
83
84
/// app.listen("127.0.0.1:8080").await?;
84
85
/// #
85
86
/// # Ok(()) })}
86
87
/// ```
87
88
#[ must_use]
88
- pub fn uri ( & self ) -> & Url {
89
+ pub fn url ( & self ) -> & Url {
89
90
self . req . url ( )
90
91
}
91
92
@@ -269,7 +270,7 @@ impl<State> Request<State> {
269
270
// Default to an empty query string if no query parameter has been specified.
270
271
// This allows successful deserialisation of structs where all fields are optional
271
272
// when none of those fields has actually been passed by the caller.
272
- let query = self . uri ( ) . query ( ) . unwrap_or ( "" ) ;
273
+ let query = self . url ( ) . query ( ) . unwrap_or ( "" ) ;
273
274
serde_qs:: from_str ( query) . map_err ( |e| {
274
275
// Return the displayable version of the deserialisation error to the caller
275
276
// for easier debugging.
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ async fn nested() {
34
34
35
35
#[ async_std:: test]
36
36
async fn nested_middleware ( ) {
37
- let echo_path = |req : tide:: Request < ( ) > | async move { Ok ( req. uri ( ) . path ( ) . to_string ( ) ) } ;
37
+ let echo_path = |req : tide:: Request < ( ) > | async move { Ok ( req. url ( ) . path ( ) . to_string ( ) ) } ;
38
38
39
39
#[ derive( Debug , Clone , Default ) ]
40
40
pub struct TestMiddleware ;
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ impl<State: Send + Sync + 'static> Middleware<State> for TestMiddleware {
30
30
}
31
31
32
32
async fn echo_path < State > ( req : tide:: Request < State > ) -> tide:: Result < String > {
33
- Ok ( req. uri ( ) . path ( ) . to_string ( ) )
33
+ Ok ( req. url ( ) . path ( ) . to_string ( ) )
34
34
}
35
35
36
36
#[ async_std:: test]
You can’t perform that action at this time.
0 commit comments