Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding AFRestClient -cancelHTTPOperationsWithRequest: and -cancelAllH…

…TTPOperations
  • Loading branch information...
commit 4d5ae429361bf7f746034282bb14cfe379bf563e 1 parent 6d213e0
@mattt mattt authored
Showing with 18 additions and 0 deletions.
  1. +4 −0 AFNetworking/AFRestClient.h
  2. +14 −0 AFNetworking/AFRestClient.m
View
4 AFNetworking/AFRestClient.h
@@ -48,6 +48,10 @@
success:(void (^)(id response))success
failure:(void (^)(NSError *error))failure;
+- (void)cancelHTTPOperationsWithRequest:(NSURLRequest *)request;
+
+- (void)cancelAllHTTPOperations;
+
- (void)getPath:(NSString *)path
parameters:(NSDictionary *)parameters
success:(void (^)(id response))success;
View
14 AFNetworking/AFRestClient.m
@@ -135,6 +135,20 @@ - (void)enqueueHTTPOperationWithRequest:(NSURLRequest *)request success:(void (^
[self.operationQueue addOperation:operation];
}
+- (void)cancelHTTPOperationsWithRequest:(NSURLRequest *)request {
+ for (AFHTTPRequestOperation *operation in [self.operationQueue operations]) {
+ if ([[operation request] isEqual:request]) {
+ [operation cancel];
+ }
+ }
+}
+
+- (void)cancelAllHTTPOperations {
+ [self.operationQueue cancelAllOperations];
+}
+
+#pragma mark -
+
- (void)getPath:(NSString *)path parameters:(NSDictionary *)parameters success:(void (^)(id response))success {
[self getPath:path parameters:parameters success:success failure:nil];
}
Please sign in to comment.
Something went wrong with that request. Please try again.