diff --git a/.gitignore b/.gitignore index bd5adc7..d9b2144 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,5 @@ profile DerivedData .idea/ Tests/Pods +Tests/Podfile.lock Tests/AFNetworking Tests.xcodeproj/xcshareddata/xcschemes/ diff --git a/AFNetworking/AFURLConnectionOperation.m b/AFNetworking/AFURLConnectionOperation.m index 58c305e..4498513 100644 --- a/AFNetworking/AFURLConnectionOperation.m +++ b/AFNetworking/AFURLConnectionOperation.m @@ -528,6 +528,11 @@ static BOOL AFSecKeyIsEqualToKey(SecKeyRef key1, SecKeyRef key2) { }); 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]; } } diff --git a/Tests/AFHTTPRequestOperationTests.m b/Tests/AFHTTPRequestOperationTests.m index b1ffa08..20fc05c 100644 --- a/Tests/AFHTTPRequestOperationTests.m +++ b/Tests/AFHTTPRequestOperationTests.m @@ -76,6 +76,8 @@ } - (void)testThatCancellationOfRequestOperationInvokesFailureCompletionBlock { + [Expecta setAsynchronousTestTimeout:10.0]; + __block NSError *blockError = nil; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/delay/5" relativeToURL:self.baseURL]]; diff --git a/Tests/Podfile.lock b/Tests/Podfile.lock deleted file mode 100644 index 6e9fc9d..0000000 --- a/Tests/Podfile.lock +++ /dev/null @@ -1,24 +0,0 @@ -PODS: - - AFHTTPRequestOperationLogger (0.10.0): - - AFNetworking (>= 0.9.0) - - AFNetworking (1.3.1) - - Expecta (0.2.1) - - OCMock (2.1.1) - -DEPENDENCIES: - - AFHTTPRequestOperationLogger (~> 0.10.0) - - AFNetworking (from `../`) - - Expecta (~> 0.2.1) - - OCMock (~> 2.1.1) - -EXTERNAL SOURCES: - AFNetworking: - :path: ../ - -SPEC CHECKSUMS: - AFHTTPRequestOperationLogger: 34ba125cb9eeb77a3b67aaaca105720ba3a0798c - AFNetworking: 9ec8aafb9269236a7630bd8d9838ce2ba30fa2a0 - Expecta: d46fb1bd78c90a83da0158b9b1e108de106e369f - OCMock: 79212e5e328378af5cfd6edb5feacfd6c49cd8a3 - -COCOAPODS: 0.22.2