Skip to content
Snippets Groups Projects
Verified Commit 32e31f1d authored by Thomas Flori's avatar Thomas Flori
Browse files

send multi value headers in one header row except set-cookie

https://tools.ietf.org/html/rfc7230 states out the the Set-Cookie header
field is a special case that can not be combined.
parent 471e0002
No related branches found
No related tags found
No related merge requests found
...@@ -11,11 +11,17 @@ if (!function_exists('sendResponse')) { ...@@ -11,11 +11,17 @@ if (!function_exists('sendResponse')) {
$response->getReasonPhrase() $response->getReasonPhrase()
); );
header($http_line, true, $response->getStatusCode()); header($http_line, true, $response->getStatusCode());
foreach ($response->getHeaders() as $name => $values) { foreach ($response->getHeaders() as $name => $values) {
foreach ($values as $value) { if (strtolower($name) !== 'set-cookie') {
header("$name: $value", false); header(sprintf('%s: %s', $name, implode(',', $values)), false);
} else {
foreach ($values as $value) {
header(sprintf('%s: %s', $name, $value), false);
}
} }
} }
$stream = $response->getBody(); $stream = $response->getBody();
if ($stream->isSeekable()) { if ($stream->isSeekable()) {
$stream->rewind(); $stream->rewind();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment