@@ -214,7 +214,9 @@ public function testRedirects()
214214 $ client = $ this ->getHttpClient ();
215215 $ response = $ client ->request ('POST ' , 'http://localhost:8057/301 ' , [
216216 'auth ' => 'foo:bar ' ,
217- 'body ' => 'foo=bar ' ,
217+ 'body ' => function () {
218+ yield 'foo=bar ' ;
219+ },
218220 ]);
219221
220222 $ body = json_decode ($ response ->getContent (), true );
@@ -236,7 +238,9 @@ public function testRedirects()
236238 'Content-Type: application/json ' ,
237239 ];
238240
239- $ filteredHeaders = array_intersect ($ expected , $ response ->getInfo ('raw_headers ' ));
241+ $ filteredHeaders = array_values (array_filter ($ response ->getInfo ('raw_headers ' ), function ($ h ) {
242+ return \in_array (substr ($ h , 0 , 4 ), ['HTTP ' , 'Loca ' , 'Cont ' ], true ) && 'Content-Encoding: gzip ' !== $ h ;
243+ }));
240244
241245 $ this ->assertSame ($ expected , $ filteredHeaders );
242246 }
@@ -261,6 +265,16 @@ public function testRelativeRedirects()
261265 public function testRedirect307 ()
262266 {
263267 $ client = $ this ->getHttpClient ();
268+
269+ $ response = $ client ->request ('POST ' , 'http://localhost:8057/307 ' , [
270+ 'body ' => function () {
271+ yield 'foo=bar ' ;
272+ },
273+ 'max_redirects ' => 0 ,
274+ ]);
275+
276+ $ this ->assertSame (307 , $ response ->getStatusCode ());
277+
264278 $ response = $ client ->request ('POST ' , 'http://localhost:8057/307 ' , [
265279 'body ' => 'foo=bar ' ,
266280 ]);
@@ -297,7 +311,9 @@ public function testMaxRedirects()
297311 'Content-Type: application/json ' ,
298312 ];
299313
300- $ filteredHeaders = array_intersect ($ expected , $ response ->getInfo ('raw_headers ' ));
314+ $ filteredHeaders = array_values (array_filter ($ response ->getInfo ('raw_headers ' ), function ($ h ) {
315+ return \in_array (substr ($ h , 0 , 4 ), ['HTTP ' , 'Loca ' , 'Cont ' ], true );
316+ }));
301317
302318 $ this ->assertSame ($ expected , $ filteredHeaders );
303319 }
@@ -416,6 +432,7 @@ public function testPostCallback()
416432 $ response = $ client ->request ('POST ' , 'http://localhost:8057/post ' , [
417433 'body ' => function () {
418434 yield 'foo ' ;
435+ yield '' ;
419436 yield '= ' ;
420437 yield '0123456789 ' ;
421438 },
0 commit comments