Skip to content

Commit

Permalink
Fixed duplicating headers bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dariuszz123 committed Feb 8, 2022
1 parent c58636c commit a9ccc90
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions CiHelperService.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public function getResponse(Request $request)
$this->setCiPaths($request);

require_once __DIR__.'/ci_bootstrap.php';

ob_start();

/*
Expand All @@ -267,7 +267,7 @@ public function getResponse(Request $request)
*/
\ci_bootstrap($this->kernel);

$response = new Response(ob_get_clean(), http_response_code(), $this->getHeaders());
$response = new Response(ob_get_clean(), http_response_code(), $this->extractHeaders());

return $response;
}
Expand All @@ -277,20 +277,22 @@ public function getResponse(Request $request)
*
* @return array
*/
private function getHeaders()
private function extractHeaders()
{
$list = array();

$headers = headers_list();

foreach ($headers as $header) {
$header = explode(':', $header, 2);
$list[array_shift($header)] = trim(implode(':', $header));
$name = array_shift($header);
header_remove($name);
$list[$name] = trim(implode(':', $header));
}

return $list;
}

/**
* Returns CI APPPATH
*
Expand Down

0 comments on commit a9ccc90

Please sign in to comment.