Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dd1111e

Browse filesBrowse 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
Copy full SHA for dd1111e

File tree

2 files changed

+7
-2
lines changed
Filter options

2 files changed

+7
-2
lines changed

‎Factory/HttpFoundationFactory.php

Copy file name to clipboardExpand all lines: Factory/HttpFoundationFactory.php
+4-1Lines 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

Copy file name to clipboardExpand all lines: Tests/Fixtures/Message.php
+3-1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.