@@ -214,7 +214,9 @@ public function testRedirects()
214
214
$ client = $ this ->getHttpClient ();
215
215
$ response = $ client ->request ('POST ' , 'http://localhost:8057/301 ' , [
216
216
'auth ' => 'foo:bar ' ,
217
- 'body ' => 'foo=bar ' ,
217
+ 'body ' => function () {
218
+ yield 'foo=bar ' ;
219
+ },
218
220
]);
219
221
220
222
$ body = json_decode ($ response ->getContent (), true );
@@ -236,7 +238,9 @@ public function testRedirects()
236
238
'Content-Type: application/json ' ,
237
239
];
238
240
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
+ }));
240
244
241
245
$ this ->assertSame ($ expected , $ filteredHeaders );
242
246
}
@@ -261,6 +265,16 @@ public function testRelativeRedirects()
261
265
public function testRedirect307 ()
262
266
{
263
267
$ 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
+
264
278
$ response = $ client ->request ('POST ' , 'http://localhost:8057/307 ' , [
265
279
'body ' => 'foo=bar ' ,
266
280
]);
@@ -297,7 +311,9 @@ public function testMaxRedirects()
297
311
'Content-Type: application/json ' ,
298
312
];
299
313
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
+ }));
301
317
302
318
$ this ->assertSame ($ expected , $ filteredHeaders );
303
319
}
@@ -416,6 +432,7 @@ public function testPostCallback()
416
432
$ response = $ client ->request ('POST ' , 'http://localhost:8057/post ' , [
417
433
'body ' => function () {
418
434
yield 'foo ' ;
435
+ yield '' ;
419
436
yield '= ' ;
420
437
yield '0123456789 ' ;
421
438
},
0 commit comments