Skip to content

Commit

Permalink
Skip non-AFHTTPRequestOperations in AFHTTPClient -cancelAllHTTPOperat…
Browse files Browse the repository at this point in the history
…ionsWithMethod
  • Loading branch information
mattt committed Mar 1, 2012
1 parent f489189 commit cac44ae
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions AFNetworking/AFHTTPClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,12 @@ - (void)enqueueHTTPRequestOperation:(AFHTTPRequestOperation *)operation {
}

- (void)cancelAllHTTPOperationsWithMethod:(NSString *)method path:(NSString *)path {
for (AFHTTPRequestOperation *operation in [self.operationQueue operations]) {
if ((!method || [method isEqualToString:[[operation request] HTTPMethod]]) && [path isEqualToString:[[[operation request] URL] path]]) {
for (NSOperation *operation in [self.operationQueue operations]) {
if (![operation isKindOfClass:[AFHTTPRequestOperation class]]) {
continue;
}

if ((!method || [method isEqualToString:[[(AFHTTPRequestOperation *)operation request] HTTPMethod]]) && [path isEqualToString:[[[(AFHTTPRequestOperation *)operation request] URL] path]]) {
[operation cancel];
}
}
Expand Down

0 comments on commit cac44ae

Please sign in to comment.