Skip to content

Commit

Permalink
Merge pull request #18 from t3n/adjust-response
Browse files Browse the repository at this point in the history
Adjust response instead of create a new one
  • Loading branch information
Alex Kleine-Börger authored Mar 10, 2020
2 parents 5eb140c + 881ea62 commit 0ef6dcc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Classes/RoutingComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ protected function redirectIfNecessary(ComponentContext $componentContext, UriIn
//set default redirect statusCode if configuration is not set
$statusCode = array_key_exists('statusCode', $this->configuration) ? $this->configuration['statusCode'] : 301;

/** @var ResponseInterface $response */
$response = new Response((int) $statusCode, ['Location' => (string) $uri]);
$response = $componentContext->getHttpResponse()->withStatus($statusCode);
$response = $response->withAddedHeader('Location', (string) $uri);

$componentContext->replaceHttpResponse($response);
$componentContext->setParameter(ComponentChain::class, 'cancel', true);
Expand Down

0 comments on commit 0ef6dcc

Please sign in to comment.