From bad206b41fa5a9d9d3185cfde60019f5b6a5df88 Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Tue, 9 Oct 2012 09:14:26 -0700 Subject: [PATCH] [Issue #465] Instead of enforcing non-nil parameter, allow it to signify not appending a path to the base URL when matching --- AFNetworking/AFHTTPClient.h | 2 +- AFNetworking/AFHTTPClient.m | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/AFNetworking/AFHTTPClient.h b/AFNetworking/AFHTTPClient.h index e79f686..bb631c5 100755 --- a/AFNetworking/AFHTTPClient.h +++ b/AFNetworking/AFHTTPClient.h @@ -300,7 +300,7 @@ typedef enum { Cancels all operations in the HTTP client's operation queue whose URLs match the specified HTTP method and path. @param method The HTTP method to match for the cancelled requests, such as `GET`, `POST`, `PUT`, or `DELETE`. If `nil`, all request operations with URLs matching the path will be cancelled. - @param path The path appended to the HTTP client base URL to match against the cancelled requests. This parameter must not be `nil`. + @param path The path appended to the HTTP client base URL to match against the cancelled requests. If `nil`, no path will be appended to the base URL. @discussion This method only cancels `AFHTTPRequestOperations` whose request URL matches the HTTP client base URL with the path appended. For complete control over the lifecycle of enqueued operations, you can access the `operationQueue` property directly, which allows you to, for instance, cancel operations filtered by a predicate, or simply use `-cancelAllRequests`. Note that the operation queue may include non-HTTP operations, so be sure to check the type before attempting to directly introspect an operation's `request` property. */ diff --git a/AFNetworking/AFHTTPClient.m b/AFNetworking/AFHTTPClient.m index 5270dc1..6401a56 100755 --- a/AFNetworking/AFHTTPClient.m +++ b/AFNetworking/AFHTTPClient.m @@ -527,9 +527,7 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {} - (void)cancelAllHTTPOperationsWithMethod:(NSString *)method path:(NSString *)path -{ - NSCParameterAssert(path); - +{ NSString *URLStringToMatched = [[[self requestWithMethod:(method ?: @"GET") path:path parameters:nil] URL] absoluteString]; for (NSOperation *operation in [self.operationQueue operations]) {