[Issue #465] Instead of enforcing non-nil parameter, allow it to signify not appending a path to the base URL when matching

This commit is contained in:
Mattt Thompson 2012-10-09 09:14:26 -07:00
parent a2e0453cda
commit bad206b41f
2 changed files with 2 additions and 4 deletions

View file

@ -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. 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 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. @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.
*/ */

View file

@ -527,9 +527,7 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {}
- (void)cancelAllHTTPOperationsWithMethod:(NSString *)method - (void)cancelAllHTTPOperationsWithMethod:(NSString *)method
path:(NSString *)path path:(NSString *)path
{ {
NSCParameterAssert(path);
NSString *URLStringToMatched = [[[self requestWithMethod:(method ?: @"GET") path:path parameters:nil] URL] absoluteString]; NSString *URLStringToMatched = [[[self requestWithMethod:(method ?: @"GET") path:path parameters:nil] URL] absoluteString];
for (NSOperation *operation in [self.operationQueue operations]) { for (NSOperation *operation in [self.operationQueue operations]) {