I accidentally mistyped the post path and noticed that although it's being wrong, the success block is called:
[[APIClient sharedInstance]
postPath:@"api_url"
parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"Result: Success %@",[responseObject description]);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
//handle error
NSLog(@"Result: Failure + %@",error.userInfo);
}];
Of course the data are not being sent to server and the transaction is not processed, but I want to know why it's not the failure
block which is supposed to be called in case the path is wrong? Thanx.
Failure is called if the requestOperation
has an associated error after finishing. Reasons for an error include the response having the incorrect Content-Type
, not having an acceptable status code (2XX range, by default), or an error processing the downloaded data.
Why your server returned a 200 response with the correct content type is a question only something you can determine.