JSON as body response to 4xx and 5xx HTTP status codes is not handled
tonyarnold opened this issue · 2 comments
tonyarnold commented
Currently, JSON passed back as the response body from 4xx
and 5xx
HTTP status codes is left as NSData
. It would be helpful if this were handled in the same manner as non error status codes — my API passes relevant information about the error back in the body as JSON.
samvermette commented
SVHTTPRequest looks for a application/json
response MIMEType to determine whether or not it should automatically serialize it as a JSON object. AFAIK whether the response is 2xx or 4xx or 5xx shouldn't matter. Are you using a private REST API? Are you sure the 4xx and 5xx endpoints do have the content-type header set as application/json
?
tonyarnold commented
Ah, no, they did not. I've fixed the problem in the service, and all is well. Thanks, Sam!