HTTP status code different from 2xx prevent parsing of JSON response body - cont'd #304

Closed
apicolet opened this Issue Dec 20, 2012 · 0 comments

2 participants

@apicolet

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 :

  • a response structure with the response data as JSON, if HTTP status was 2xx
  • a errorData structure with a hardcoded error text if the HTTP status was an error

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.

@piuccio piuccio was assigned Jan 8, 2013
@piuccio piuccio added a commit to piuccio/ariatemplates that referenced this issue Jan 8, 2013
@piuccio piuccio 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.
802e677
@piuccio piuccio added a commit that closed this issue Jan 9, 2013
@piuccio piuccio 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.
e2699f4
@piuccio piuccio closed this in e2699f4 Jan 9, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment