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

Commit

Permalink
Content-Disposition header is now imported by HttpProxyResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
Joan Fabrégat committed May 3, 2018
1 parent 88086b1 commit 2d638ef
Showing 1 changed file with 9 additions and 1 deletion.
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 2d638ef

Please sign in to comment.