Skip to content

Commit 481a8df

Browse files
committed
Allow empty uri
1 parent 20cb10b commit 481a8df

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

packages/http/src/Response/RedirectResponse.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ class RedirectResponse extends Response
1919
/**
2020
* Constructor.
2121
*
22-
* @param string|Stringable $uri The redirect uri.
23-
* @param int $status The status code.
24-
* @param array $headers The custom headers.
22+
* @param string|Stringable|null $uri The redirect uri.
23+
* @param int $status The status code.
24+
* @param array $headers The custom headers.
2525
*/
26-
public function __construct(string|Stringable $uri, int $status = 303, array $headers = [])
26+
public function __construct(string|Stringable|null $uri = null, int $status = 303, array $headers = [])
2727
{
28-
$headers['location'] = [(string) $uri];
28+
if ($uri !== null) {
29+
$headers['location'] = [(string) $uri];
30+
}
2931

3032
parent::__construct(new NullStream(), $status, $headers);
3133
}

0 commit comments

Comments
 (0)