Skip to content

Commit

Permalink
Hide more headers from sample responses
Browse files Browse the repository at this point in the history
  • Loading branch information
shalvah committed Jun 24, 2021
1 parent d1a9a81 commit 5583b72
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions camel/Extraction/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Knuckles\Camel\Extraction;



use Knuckles\Camel\BaseDTO;

class Response extends BaseDTO
Expand All @@ -21,9 +20,27 @@ public function __construct(array $parameters = [])
if (is_array($parameters['content'])) {
$parameters['content'] = json_encode($parameters['content']);
}

$hiddenHeaders = [
'date',
'Date',
'etag',
'ETag',
'last-modified',
'Last-Modified',
'date',
'Date',
'content-length',
'Content-Length',
'connection',
'Connection',
'x-powered-by',
'X-Powered-By',
];
if (!empty($parameters['headers'])) {
unset($parameters['headers']['date']);
unset($parameters['headers']['Date']);
foreach ($hiddenHeaders as $headerName) {
unset($parameters['headers'][$headerName]);
}
}

return parent::__construct($parameters);
Expand Down

0 comments on commit 5583b72

Please sign in to comment.