Skip to content

Commit dd1111e

Browse files
tinyroynicolas-grekas
authored andcommitted
removed 'Set-Cookie' from header when it is already converted to a Symfony header cookie
1 parent ba672d8 commit dd1111e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Factory/HttpFoundationFactory.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,17 @@ protected function getTemporaryPath()
140140
*/
141141
public function createResponse(ResponseInterface $psrResponse)
142142
{
143+
$cookies = $psrResponse->getHeader('Set-Cookie');
144+
$psrResponse = $psrResponse->withHeader('Set-Cookie', array());
145+
143146
$response = new Response(
144147
$psrResponse->getBody()->__toString(),
145148
$psrResponse->getStatusCode(),
146149
$psrResponse->getHeaders()
147150
);
148151
$response->setProtocolVersion($psrResponse->getProtocolVersion());
149152

150-
foreach ($psrResponse->getHeader('Set-Cookie') as $cookie) {
153+
foreach ($cookies as $cookie) {
151154
$response->headers->setCookie($this->createCookie($cookie));
152155
}
153156

Tests/Fixtures/Message.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ public function getHeaderLine($name)
6464

6565
public function withHeader($name, $value)
6666
{
67-
throw new \BadMethodCallException('Not implemented.');
67+
$this->headers[$name] = (array) $value;
68+
69+
return $this;
6870
}
6971

7072
public function withAddedHeader($name, $value)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy