File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -771,4 +771,30 @@ mod test {
771
771
772
772
Ok ( ( ) )
773
773
}
774
+
775
+ #[ async_std:: test]
776
+ async fn chain_skip_start ( ) -> crate :: Result < ( ) > {
777
+ for buf_len in 1 ..26 {
778
+ let mut body1 = Body :: from_reader ( Cursor :: new ( "1234 hello xyz" ) , Some ( 11 ) ) ;
779
+ let mut buf = vec ! [ 0 ; 5 ] ;
780
+ body1. read ( & mut buf) . await ?;
781
+ assert_eq ! ( buf, b"1234 " ) ;
782
+
783
+ let mut body2 = Body :: from_reader ( Cursor :: new ( "321 world abc" ) , Some ( 9 ) ) ;
784
+ let mut buf = vec ! [ 0 ; 4 ] ;
785
+ body2. read ( & mut buf) . await ?;
786
+ assert_eq ! ( buf, b"321 " ) ;
787
+
788
+ let mut body = body1. chain ( body2) ;
789
+ assert_eq ! ( body. len( ) , Some ( 11 ) ) ;
790
+ assert_eq ! ( body. mime( ) , & mime:: BYTE_STREAM ) ;
791
+ assert_eq ! (
792
+ read_with_buffers_of_size( & mut body, buf_len) . await ?,
793
+ "hello world"
794
+ ) ;
795
+ assert_eq ! ( body. bytes_read, 11 ) ;
796
+ }
797
+
798
+ Ok ( ( ) )
799
+ }
774
800
}
You can’t perform that action at this time.
0 commit comments