Skip to content
This repository has been archived by the owner on Feb 5, 2019. It is now read-only.

Commit

Permalink
Merge pull request #10 from CodeIncHQ/1.x
Browse files Browse the repository at this point in the history
v1.3.1
  • Loading branch information
Joan Fabrégat authored May 3, 2018
2 parents 2737a5f + 2d638ef commit d47ed8e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codeinc/psr7-responses",
"version": "1.3.0",
"version": "1.3.1",
"description": "A collection of PSR-7 responses",
"homepage": "https://github.com/CodeIncHQ/Psr7Responses",
"type": "library",
Expand Down
10 changes: 9 additions & 1 deletion src/HttpProxyResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@
*/
class HttpProxyResponse extends Response
{
protected const IMPORT_HEADERS = [
'content-type',
'last-modified',
'content-length',
'date',
'content-disposition'
];

/**
* ProxyResponse constructor.
*
Expand Down Expand Up @@ -68,7 +76,7 @@ public function __construct(string $remoteUrl, int $status = 200, array $headers
// importing the headers
foreach ($http_response_header as $header) {
if (preg_match('/^([\\w-]+): +(.+)$/ui', $header, $matches)) {
if (in_array(strtolower($matches[1]), ['content-type', 'last-modified', 'content-length', 'date'])) {
if (in_array(strtolower($matches[1]), self::IMPORT_HEADERS)) {
$headers[$matches[1]] = $matches[2];
}
}
Expand Down

0 comments on commit d47ed8e

Please sign in to comment.