-
-
Notifications
You must be signed in to change notification settings - Fork 71
Open
Labels
QuestionFurther information is requestedFurther information is requested
Description
Bug Report
| Q | A |
|---|---|
| Version(s) | 1.8.0 |
Summary
I want to throw exception inside Rpc controller, like this:
$ex = new \Laminas\ApiTools\ApiProblem\Exception\DomainException('The request you made was malformed', 400);
$ex->setType('/documentation/problems/malformed-request');
$ex->setTitle('Malformed Request');
$ex->setAdditionalDetails([
'missing-sort-direction' => 'The sort direction query string was missing and is required'
]);
throw $ex;
And I got an exception in html format (/module/Application/view/error/index.phtml works), but I was expecting response in JSON, like this:
HTTP/1.1 500 Internal Error
Content-Type: application/problem+json
{
"type": "/documentation/problems/malformed-request",
"detail": "The request you made was malformed",
"status": 400,
"title": "Malformed Request",
"missing-sort-direction": "The sort direction query string was missing and is required"
}
Of course I have header Content-Type: application/json
What I do incorrect? How can I get exception in Json format?
Metadata
Metadata
Assignees
Labels
QuestionFurther information is requestedFurther information is requested