AFNetworking/AFNetworking — Issue #210: JSON response (or access to response body) in non 2xx response
Author: aaronpeterson
Created: 2012-02-18 10:29:42+00:00
State: open

RE: closed issue https://github.com/AFNetworking/AFNetworking/issues/83 maybe this is just a docs/wiki issue. I've had a similar issue with even jQuery's .ajax demoting response body on non 2xx. In jQuery it's an issue of manually parsing JSON even though you've already specified JSON as your filter despite RFC 2616 10.4.

Is AFHTTPClient's registerHTTPOperationClass:[AFJSONRequestOperation class] intended to set the request operation strategy? What should the failure block arguments officially be with this? I see this running but I'm having trouble getting the block right. Not sure if documentation is outdated.

I see the call to failure(operation.request, operation.response, error, [(AFJSONRequestOperation *)operation responseJSON]) in AFJSONRequestOperation yet it seems like I'm getting NSError as the second argument even after verifying the runtime implementation (I call this a strategy, maybe I'm wrong) is being selected.

I'm trying to find a library that can 1) parse my NSDictionary params for get, post, put, and delete but also include content in the "error" block/delegate. Is ASI the way to go if you need error content access? I'll take any access to non-2xx response body. "Email is already in use" is very valuable 4xx content.