Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
apicolet opened this Issue · 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
@piuccio piuccio referenced this issue from a commit in piuccio/ariatemplates
@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 closed this issue from a commit
@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
@susant123 susant123 referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.