Refactoring failure case for connection:needNewBodyStream:

This commit is contained in:
Mattt Thompson 2013-05-08 10:17:03 -07:00
parent 38c49e1532
commit fa0c8b8ddc

View file

@ -703,17 +703,11 @@ didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{ {
if ([request.HTTPBodyStream conformsToProtocol:@protocol(NSCopying)]) { if ([request.HTTPBodyStream conformsToProtocol:@protocol(NSCopying)]) {
return [request.HTTPBodyStream copy]; return [request.HTTPBodyStream copy];
} else {
[self cancelConnection];
return nil;
} }
self.error = [NSError errorWithDomain:AFNetworkingErrorDomain code:NSURLErrorCancelled userInfo:nil];
[self.outputStream close];
[self finish];
self.connection = nil;
return nil;
} }
- (NSURLRequest *)connection:(NSURLConnection *)connection - (NSURLRequest *)connection:(NSURLConnection *)connection