You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For some reason, when using RNCachingURLProtocol together with AFNetworking, all my POST requests (JSON) to the API by AFNetworking stopped working. Took me a while to find out that RNCachingURLProtocol was interfering with it at some point.
Once I removed RNCachingURLProtocol, the API started working again.
All my POST requests were getting to the API as GET requests.
RNCachingURLProtocol explicitly does not cache POST requests (or anything but GET requests). It's sample code to demonstrate how to build your own NSURLProtocol. It is typically configured by rewriting the parts that you want changed.
That said, this would not be a bad pull request. You just need to check that HTTPMethod is GET in canInitWithRequest: and return NO if it isn't. That would be a reasonable default behavior.
For some reason, when using RNCachingURLProtocol together with AFNetworking, all my POST requests (JSON) to the API by AFNetworking stopped working. Took me a while to find out that RNCachingURLProtocol was interfering with it at some point.
Once I removed RNCachingURLProtocol, the API started working again.
All my POST requests were getting to the API as GET requests.
This is the code I was using:
AFHTTPRequestOperationManager *manager = [[AFHTTPRequestOperationManager alloc] init];
[manager setRequestSerializer:[AFJSONRequestSerializer serializer]];
[manager.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[manager.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Accept"];
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
The text was updated successfully, but these errors were encountered: