Skip to content

Commit 5140a3d

Browse files
author
Jeremy Sik
authored
Merge pull request #63 from spira/hotfix/switchable-replace-headers
Adding param which allows replace headers to be disabled when creatin…
2 parents fcfb994 + 0acc28b commit 5140a3d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Responder/Response/ApiResponse.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ public function noContent($code = self::HTTP_NO_CONTENT)
6767
* Bind an item to a transformer and start building a response.
6868
* @param $item
6969
* @param int $statusCode
70+
* @param bool $replaceHeaders
7071
* @return ApiResponse
7172
*/
72-
public function item($item, $statusCode = null)
73+
public function item($item, $statusCode = null, $replaceHeaders = true)
7374
{
7475
if ($this->transformer) {
7576
$item = $this->transformer->transformItem($item, $this->getTransformerOptions());
@@ -84,7 +85,7 @@ public function item($item, $statusCode = null)
8485
}
8586

8687
return $this
87-
->header('Content-Type', 'application/json')
88+
->header('Content-Type', 'application/json', $replaceHeaders)
8889
->setContent($this->encode($item))
8990
->setStatusCode($statusCode);
9091
}

0 commit comments

Comments
 (0)