Skip to content

Commit 9b3ceac

Browse files
trvrnrthTrevor North
authored andcommitted
Decorate responses created by withRedirect helper
1 parent 9ada50c commit 9b3ceac

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/Response.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,11 +370,12 @@ public function withRedirect(string $url, $status = null): ResponseInterface
370370
{
371371
$response = $this->response->withHeader('Location', $url);
372372

373-
if (!is_null($status)) {
374-
return $response->withStatus($status);
373+
if ($status === null) {
374+
$status = 302;
375375
}
376+
$response = $response->withStatus($status);
376377

377-
return $response->withStatus(302);
378+
return new Response($response, $this->streamFactory);
378379
}
379380

380381
/**

0 commit comments

Comments
 (0)