File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -83,25 +83,26 @@ impl<T: AsRef<str>> Redirect<T> {
83
83
location,
84
84
}
85
85
}
86
-
87
- /// Returns response with equivalent redirect.
88
- pub fn response ( & self ) -> Response {
89
- Response :: new ( self . status ) . set_header ( "location" . parse ( ) . unwrap ( ) , & self . location )
90
- }
91
86
}
92
87
93
88
impl < State , T > Endpoint < State > for Redirect < T >
94
89
where
95
90
T : AsRef < str > + Send + Sync + ' static ,
96
91
{
97
92
fn call < ' a > ( & ' a self , _req : Request < State > ) -> BoxFuture < ' a , crate :: Result < Response > > {
98
- let res = self . response ( ) ;
93
+ let res = self . into ( ) ;
99
94
Box :: pin ( async move { Ok ( res) } )
100
95
}
101
96
}
102
97
103
98
impl < T : AsRef < str > > Into < Response > for Redirect < T > {
104
99
fn into ( self ) -> Response {
105
- self . response ( )
100
+ ( & self ) . into ( )
101
+ }
102
+ }
103
+
104
+ impl < T : AsRef < str > > Into < Response > for & Redirect < T > {
105
+ fn into ( self ) -> Response {
106
+ Response :: new ( self . status ) . set_header ( "location" . parse ( ) . unwrap ( ) , & self . location )
106
107
}
107
108
}
You can’t perform that action at this time.
0 commit comments