Open weierophinney opened 4 years ago
I can confirm this...
Originally posted by @Wilt at https://github.com/zfcampus/zf-hal/issues/121#issuecomment-148744285
A pull request for this issue can be found here: https://github.com/zfcampus/zf-hal/pull/127
Originally posted by @Wilt at https://github.com/zfcampus/zf-hal/issues/121#issuecomment-148749857
Maybe good idea to add a test?
Originally posted by @Wilt at https://github.com/zfcampus/zf-hal/issues/121#issuecomment-148750023
Another solution would be to include a
/**
* Does the payload represent a ApiProblem?
*
* @return bool
*/
public function isApiProblem()
{
$payload = $this->getPayload();
return ($payload instanceof ApiProblem);
}
And use this method inside injectResponse
method:
if ($model instanceof HalJsonModel){
if($model->isApiProblem){
$contentType = 'application/problem+json'
}elseif($model->isCollection() || $model->isEntity()){
$contentType = 'application/hal+json';
}
}
Originally posted by @Wilt at https://github.com/zfcampus/zf-hal/issues/121#issuecomment-148750614
When I make request on non existing resource page
/users?page=1234567
I receive:As you see it a api problem. However in
Content-Type
you can findapplication/json
instead ofapplication/problem+json
Originally posted by @snapshotpl at https://github.com/zfcampus/zf-hal/issues/121