Merge pull request #1167 from carsonmcdonald/fixquickcancel
Fix for quick canceling request operation
This commit is contained in:
commit
7c3ba69f09
2 changed files with 7 additions and 0 deletions
|
|
@ -528,6 +528,11 @@ static BOOL AFSecKeyIsEqualToKey(SecKeyRef key1, SecKeyRef key2) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if ([self isCancelled]) {
|
if ([self isCancelled]) {
|
||||||
|
NSDictionary *userInfo = nil;
|
||||||
|
if ([self.request URL]) {
|
||||||
|
userInfo = [NSDictionary dictionaryWithObject:[self.request URL] forKey:NSURLErrorFailingURLErrorKey];
|
||||||
|
}
|
||||||
|
self.error = [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled userInfo:userInfo];
|
||||||
[self finish];
|
[self finish];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testThatCancellationOfRequestOperationInvokesFailureCompletionBlock {
|
- (void)testThatCancellationOfRequestOperationInvokesFailureCompletionBlock {
|
||||||
|
[Expecta setAsynchronousTestTimeout:10.0];
|
||||||
|
|
||||||
__block NSError *blockError = nil;
|
__block NSError *blockError = nil;
|
||||||
|
|
||||||
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/delay/5" relativeToURL:self.baseURL]];
|
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/delay/5" relativeToURL:self.baseURL]];
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue