From 3092ab19b8da48f6f51d71c1509716d69c482e63 Mon Sep 17 00:00:00 2001 From: Erick Hartanto Date: Wed, 23 Apr 2014 12:34:05 +0700 Subject: [PATCH] HTTP Status code should be handled manually by developer --- SVHTTPRequest/SVHTTPRequest.m | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/SVHTTPRequest/SVHTTPRequest.m b/SVHTTPRequest/SVHTTPRequest.m index b84942b..721fe35 100644 --- a/SVHTTPRequest/SVHTTPRequest.m +++ b/SVHTTPRequest/SVHTTPRequest.m @@ -554,30 +554,9 @@ - (void)callCompletionBlockWithResponse:(id)response error:(NSError *)error { if(self.operationRunLoop) CFRunLoopStop(self.operationRunLoop); - dispatch_async(dispatch_get_main_queue(), ^{ - NSError *serverError = error; - - if(!serverError) { - if(self.operationURLResponse.statusCode == 500) { - serverError = [NSError errorWithDomain:NSURLErrorDomain - code:NSURLErrorBadServerResponse - userInfo:[NSDictionary dictionaryWithObjectsAndKeys: - @"Bad Server Response.", NSLocalizedDescriptionKey, - self.operationRequest.URL, NSURLErrorFailingURLErrorKey, - self.operationRequest.URL.absoluteString, NSURLErrorFailingURLStringErrorKey, nil]]; - } - else if(self.operationURLResponse.statusCode > 299) { - serverError = [NSError errorWithDomain:NSURLErrorDomain - code:self.operationURLResponse.statusCode - userInfo:[NSDictionary dictionaryWithObjectsAndKeys: - self.operationRequest.URL, NSURLErrorFailingURLErrorKey, - self.operationRequest.URL.absoluteString, NSURLErrorFailingURLStringErrorKey, nil]]; - - } - } - + dispatch_async(dispatch_get_main_queue(), ^{ if(self.operationCompletionBlock && !self.isCancelled) - self.operationCompletionBlock(response, self.operationURLResponse, serverError); + self.operationCompletionBlock(response, self.operationURLResponse, error); [self finish]; });