Skip to content

removed 'Set-Cookie' from header when it is already converted to a Symfony header cookie #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Factory/HttpFoundationFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,17 @@ protected function getTemporaryPath()
*/
public function createResponse(ResponseInterface $psrResponse)
{
$cookies = $psrResponse->getHeader('Set-Cookie');
$psrResponse = $psrResponse->withHeader('Set-Cookie', array());

$response = new Response(
$psrResponse->getBody()->__toString(),
$psrResponse->getStatusCode(),
$psrResponse->getHeaders()
);
$response->setProtocolVersion($psrResponse->getProtocolVersion());

foreach ($psrResponse->getHeader('Set-Cookie') as $cookie) {
foreach ($cookies as $cookie) {
$response->headers->setCookie($this->createCookie($cookie));
}

Expand Down
4 changes: 3 additions & 1 deletion Tests/Fixtures/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ public function getHeaderLine($name)

public function withHeader($name, $value)
{
throw new \BadMethodCallException('Not implemented.');
$this->headers[$name] = (array) $value;

return $this;
}

public function withAddedHeader($name, $value)
Expand Down