File tree 2 files changed +32
-0
lines changed
Component/HttpClient/Tests
Contracts/HttpClient/Test/Fixtures/web
2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -673,4 +673,26 @@ public function testHeadRequestWithClosureBody()
673
673
$ this ->assertIsArray ($ vars );
674
674
$ this ->assertSame ('HEAD ' , $ vars ['REQUEST_METHOD ' ]);
675
675
}
676
+
677
+ /**
678
+ * @testWith [301]
679
+ * [302]
680
+ * [303]
681
+ */
682
+ public function testPostToGetRedirect (int $ status )
683
+ {
684
+ $ p = TestHttpServer::start (8067 );
685
+
686
+ try {
687
+ $ client = $ this ->getHttpClient (__FUNCTION__ );
688
+
689
+ $ response = $ client ->request ('POST ' , 'http://localhost:8057/custom?status= ' . $ status . '&headers[]=Location%3A%20%2F ' );
690
+ $ body = $ response ->toArray ();
691
+ } finally {
692
+ $ p ->stop ();
693
+ }
694
+
695
+ $ this ->assertSame ('GET ' , $ body ['REQUEST_METHOD ' ]);
696
+ $ this ->assertSame ('/ ' , $ body ['REQUEST_URI ' ]);
697
+ }
676
698
}
Original file line number Diff line number Diff line change 199
199
]);
200
200
201
201
exit ;
202
+
203
+ case '/custom ' :
204
+ if (isset ($ _GET ['status ' ])) {
205
+ http_response_code ((int ) $ _GET ['status ' ]);
206
+ }
207
+ if (isset ($ _GET ['headers ' ]) && is_array ($ _GET ['headers ' ])) {
208
+ foreach ($ _GET ['headers ' ] as $ header ) {
209
+ header ($ header );
210
+ }
211
+ }
202
212
}
203
213
204
214
header ('Content-Type: application/json ' , true );
You can’t perform that action at this time.
0 commit comments