Skip to content

Commit

Permalink
Merge pull request #63 from spira/hotfix/switchable-replace-headers
Browse files Browse the repository at this point in the history
Adding param which allows replace headers to be disabled when creatin…
  • Loading branch information
Jeremy Sik authored Jul 15, 2016
2 parents fcfb994 + 0acc28b commit 5140a3d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Responder/Response/ApiResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ public function noContent($code = self::HTTP_NO_CONTENT)
* Bind an item to a transformer and start building a response.
* @param $item
* @param int $statusCode
* @param bool $replaceHeaders
* @return ApiResponse
*/
public function item($item, $statusCode = null)
public function item($item, $statusCode = null, $replaceHeaders = true)
{
if ($this->transformer) {
$item = $this->transformer->transformItem($item, $this->getTransformerOptions());
Expand All @@ -84,7 +85,7 @@ public function item($item, $statusCode = null)
}

return $this
->header('Content-Type', 'application/json')
->header('Content-Type', 'application/json', $replaceHeaders)
->setContent($this->encode($item))
->setStatusCode($statusCode);
}
Expand Down

0 comments on commit 5140a3d

Please sign in to comment.