File tree Expand file tree Collapse file tree 1 file changed +10
-12
lines changed
Expand file tree Collapse file tree 1 file changed +10
-12
lines changed Original file line number Diff line number Diff line change 11use super :: { serve, Request , Response } ;
22use bytes:: Bytes ;
33use futures_util:: future:: BoxFuture ;
4- use http:: {
5- header:: { HeaderName , HeaderValue } ,
6- StatusCode ,
7- } ;
4+ use http:: header:: { HeaderName , HeaderValue } ;
5+ use std:: ops:: Deref ;
86use std:: { convert:: Infallible , future:: IntoFuture , net:: SocketAddr } ;
97use tokio:: net:: TcpListener ;
108use tower:: make:: Shared ;
@@ -144,6 +142,14 @@ pub(crate) struct TestResponse {
144142 response : reqwest:: Response ,
145143}
146144
145+ impl Deref for TestResponse {
146+ type Target = reqwest:: Response ;
147+
148+ fn deref ( & self ) -> & Self :: Target {
149+ & self . response
150+ }
151+ }
152+
147153impl TestResponse {
148154 #[ allow( dead_code) ]
149155 pub ( crate ) async fn bytes ( self ) -> Bytes {
@@ -162,14 +168,6 @@ impl TestResponse {
162168 self . response . json ( ) . await . unwrap ( )
163169 }
164170
165- pub ( crate ) fn status ( & self ) -> StatusCode {
166- StatusCode :: from_u16 ( self . response . status ( ) . as_u16 ( ) ) . unwrap ( )
167- }
168-
169- pub ( crate ) fn headers ( & self ) -> http:: HeaderMap {
170- self . response . headers ( ) . clone ( )
171- }
172-
173171 pub ( crate ) async fn chunk ( & mut self ) -> Option < Bytes > {
174172 self . response . chunk ( ) . await . unwrap ( )
175173 }
You can’t perform that action at this time.
0 commit comments