-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
Reason:
Some API does set HTTP status code to 400, whenever we did not comply with the parameters.
Let's say when we want to login, and the email we put is not a valid format, and the server API end point will return HTTP status code 400 with JSON body containing the error message.
At current code, this will trigger NSError.
A good approach is to let the programmer handle the status code by him/her self.
[[SVHTTPClient sharedClient] POST:@"users/login"
parameters:parameters
completion:^(id response, NSHTTPURLResponse *urlResponse, NSError *error) {
if (error != nil) {
// This error here should be only ios error
// Handle error
return;
}
// HTTP status code should be handled manually by the programmer here
if (urlResponse.statusCode == 200) {
// Proceed
} else {
// Show dialog box to user
}
}];
To fix this we can remove checking serverError in SVHTTPRequest.m on this function
- (void)callCompletionBlockWithResponse:(id)response error:(NSError *)error
Thank you
Metadata
Metadata
Assignees
Labels
No labels