We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0010eeb commit cd36073Copy full SHA for cd36073
2 files changed
system/HTTP/ResponseTrait.php
@@ -516,7 +516,7 @@ public function redirect(string $uri, string $method = 'auto', ?int $code = null
516
isset($_SERVER['SERVER_PROTOCOL'], $_SERVER['REQUEST_METHOD'])
517
&& $this->getProtocolVersion() >= 1.1
518
) {
519
- $code = ($_SERVER['REQUEST_METHOD'] !== 'GET')
+ $code = (in_array($_SERVER['REQUEST_METHOD'], ['POST', 'PUT', 'DELETE'], true))
520
? 303 // reference: https://en.wikipedia.org/wiki/Post/Redirect/Get
521
: 307;
522
}
tests/system/HTTP/ResponseTest.php
@@ -300,10 +300,10 @@ public function provideForRedirect()
300
['Apache/2.4.17', 'HTTP/1.1', 'POST', null, 303],
301
['Apache/2.4.17', 'HTTP/1.1', 'POST', 307, 307],
302
['Apache/2.4.17', 'HTTP/1.1', 'POST', 302, 302],
303
- ['Apache/2.4.17', 'HTTP/1.1', 'HEAD', null, 303],
+ ['Apache/2.4.17', 'HTTP/1.1', 'HEAD', null, 307],
304
['Apache/2.4.17', 'HTTP/1.1', 'HEAD', 307, 307],
305
['Apache/2.4.17', 'HTTP/1.1', 'HEAD', 302, 302],
306
- ['Apache/2.4.17', 'HTTP/1.1', 'OPTION', null, 303],
+ ['Apache/2.4.17', 'HTTP/1.1', 'OPTION', null, 307],
307
['Apache/2.4.17', 'HTTP/1.1', 'OPTION', 307, 307],
308
['Apache/2.4.17', 'HTTP/1.1', 'OPTION', 302, 302],
309
['Apache/2.4.17', 'HTTP/1.1', 'PUT', null, 303],
0 commit comments