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
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
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.
To fix this we can remove checking
serverError
inSVHTTPRequest.m
on this functionThank you
The text was updated successfully, but these errors were encountered: