Commit 13e27b7 1 parent 872af0c commit 13e27b7 Copy full SHA for 13e27b7
File tree 2 files changed +30
-0
lines changed
2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -309,6 +309,16 @@ where
309
309
. map ( |opt_chunk| opt_chunk. map_err ( crate :: error:: body) ) ,
310
310
)
311
311
}
312
+
313
+ #[ inline]
314
+ fn size_hint ( & self ) -> http_body:: SizeHint {
315
+ self . inner . size_hint ( )
316
+ }
317
+
318
+ #[ inline]
319
+ fn is_end_stream ( & self ) -> bool {
320
+ self . inner . is_end_stream ( )
321
+ }
312
322
}
313
323
314
324
pub ( crate ) type ResponseBody =
Original file line number Diff line number Diff line change @@ -303,3 +303,23 @@ fn write_timeout_large_body() {
303
303
assert ! ( err. is_timeout( ) ) ;
304
304
assert_eq ! ( err. url( ) . map( |u| u. as_str( ) ) , Some ( url. as_str( ) ) ) ;
305
305
}
306
+
307
+ #[ tokio:: test]
308
+ async fn response_body_timeout_forwards_size_hint ( ) {
309
+ let _ = env_logger:: try_init ( ) ;
310
+
311
+ let server = server:: http ( move |_req| async { http:: Response :: new ( b"hello" . to_vec ( ) . into ( ) ) } ) ;
312
+
313
+ let client = reqwest:: Client :: new ( ) ;
314
+
315
+ let url = format ! ( "http://{}/slow" , server. addr( ) ) ;
316
+
317
+ let res = client
318
+ . get ( & url)
319
+ . timeout ( Duration :: from_secs ( 1 ) )
320
+ . send ( )
321
+ . await
322
+ . expect ( "response" ) ;
323
+
324
+ assert_eq ! ( res. content_length( ) , Some ( 5 ) ) ;
325
+ }
You can’t perform that action at this time.
0 commit comments