File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ use regex::Regex;
1616use serde:: Serialize ;
1717use serde_json:: Value ;
1818use std:: convert:: TryInto ;
19- use std:: str;
19+ use std:: str:: { self , FromStr } ;
2020use url:: Url ;
2121
2222/// Implement the `Match` trait for all closures, out of the box,
@@ -65,21 +65,18 @@ pub struct MethodExactMatcher(Method);
6565/// Shorthand for [`MethodExactMatcher::new`].
6666pub fn method < T > ( method : T ) -> MethodExactMatcher
6767where
68- T : TryInto < Method > ,
69- <T as TryInto < Method > >:: Error : std:: fmt:: Debug ,
68+ T : AsRef < str > ,
7069{
7170 MethodExactMatcher :: new ( method)
7271}
7372
7473impl MethodExactMatcher {
7574 pub fn new < T > ( method : T ) -> Self
7675 where
77- T : TryInto < Method > ,
78- <T as TryInto < Method > >:: Error : std:: fmt:: Debug ,
76+ T : AsRef < str > ,
7977 {
80- let method = method
81- . try_into ( )
82- . expect ( "Failed to convert to HTTP method." ) ;
78+ let method =
79+ Method :: from_str ( & method. as_ref ( ) . to_ascii_uppercase ( ) ) . expect ( "Invalid HTTP method" ) ;
8380 Self ( method)
8481 }
8582}
You can’t perform that action at this time.
0 commit comments