The team I work with is creating an API interface for their application in order to expose data to a website that requires it. They are sending requests and responses in JSON format but are currently stymied on the following issue.
They have written their API to respond to an request that is missing required data with a 422 error code:
422 Unprocessable Entity (WebDAV; RFC 4918) -The request was well-formed but was unable to be followed due to semantic errors.
The request gets processed and a valid JSON response object gets returned from the application server but the HTTPD server is currently intercepting the response and putting in the generic ErrorDocument for a 422 error.
Wanted to see if there is a way to:
- Disable the ErrorDocument interception and just return the JSON response from the application server transparently through the Apache server
Use the ErrorDocument handler but inject the response body into the returned message - i.e.
ErrorDocument 422 ${RESPONSE_BODY}
Any other suggestions would be welcome. Our interim solution is just to return a 200 response and define the error code in the response but would rather use the HTTP error codes if possible.