Skip to content

Commit

Permalink
Headers should win if they are provided when converting Psr7 request …
Browse files Browse the repository at this point in the history
…to Cake request
  • Loading branch information
DaVinciEngineer committed Jan 4, 2017
1 parent 1a250ac commit 18e74ac
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Http/RequestTransformer.php
Expand Up @@ -41,6 +41,14 @@ public static function toCake(PsrRequest $request)
{
$post = $request->getParsedBody();
$server = $request->getServerParams();
$headers = $request->getHeaders();

foreach ($headers as $k => $value) {
$name = sprintf('HTTP_%s', strtoupper(str_replace('-', '_', $k)));
if (isset($server[$name])) {
$server[$name] = $value[0];
}
}

$files = static::getFiles($request);
if (!empty($files)) {
Expand Down

0 comments on commit 18e74ac

Please sign in to comment.