Closed arhimede closed 4 years ago
check the usage of https://github.com/mezzio/mezzio-problem-details
content-type is important all the time
example:
A server that returns response code 200 or 201 with an empty response body and Content-Type specified as application/json is misconfigured, since an empty string is not valid JSON.
As the OP indicated, specifying responseType: "text" fixes the error, since the empty body is not parsed as JSON.
A workaround is to proceed with responseType: "text" and check if the response body is empty. If the response body is not empty, then call JSON.parse(response).
This issue was done and merged to the 3.0 default branch.
All error from the 400 class: 404 402 etc.
should be returned in json format, with headers, without twig