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> {
8383 location,
8484 }
8585 }
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- }
9186}
9287
9388impl < State , T > Endpoint < State > for Redirect < T >
9489where
9590 T : AsRef < str > + Send + Sync + ' static ,
9691{
9792 fn call < ' a > ( & ' a self , _req : Request < State > ) -> BoxFuture < ' a , crate :: Result < Response > > {
98- let res = self . response ( ) ;
93+ let res = self . into ( ) ;
9994 Box :: pin ( async move { Ok ( res) } )
10095 }
10196}
10297
10398impl < T : AsRef < str > > Into < Response > for Redirect < T > {
10499 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 )
106107 }
107108}
You can’t perform that action at this time.
0 commit comments