In our application case, we use HTTP status code along functional error response (a RESTFul design recommendation), like 404 for 'flight not found' or 403 for 'your user does not have the necessary permission'. For this reason, we are interested in the server response payload even if the HTTP status is an error. However currently Aria-Template will wipe out the response payload if it detects an HTTP error code.
Pull Requestsfor issue 143 seem to have fixed the problem at the aria.core.IO level
However, it has not be done yet at the Module level, which is where we application developers will interact with the request mechanism.
Typically, when calling ModuleCtrl.submitJsonRequest(..., cb), the callback cb will be called with a res first argument that will contain either :
What we would need is for the res object to always contain the response structure, regardless of the HTTP status code, as long as it is a parsable JSON string.
fix #304 expected JSON response in RequestMgr
All request handler wipe out the failure response from the server. This prevents REST applications.
Moreover, using JSON the expected response should contain JSON also in case of errors.