Skip to content

Instantly share code, notes, and snippets.

@Crell
Created May 2, 2016 00:25
Show Gist options
  • Select an option

  • Save Crell/35006d45c3af1d500d7bc8c687508943 to your computer and use it in GitHub Desktop.

Select an option

Save Crell/35006d45c3af1d500d7bc8c687508943 to your computer and use it in GitHub Desktop.
function toJsonResponse(ApiProblem $problem, ResponseInterface $response)
{
$body = $response->getBody();
$body->rewind();
$body->write($problem->asJson($this->pretty));
return $this->toResponse($problem, $response)
->withHeader('Content-Type', 'application/problem+json')
->withBody($body);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment