Skip to content

Commit 8592ca3

Browse files
bug #61 removed 'Set-Cookie' from header when it is already converted to a Symfony header cookie (tinyroy)
This PR was merged into the 1.2-dev branch. Discussion ---------- removed 'Set-Cookie' from header when it is already converted to a Symfony header cookie Fix #25 Fix #26 Commits ------- dd1111e removed 'Set-Cookie' from header when it is already converted to a Symfony header cookie
2 parents ba672d8 + dd1111e commit 8592ca3

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