[Issue #791] Matching operations on request URL path rather than absolute URL string

This commit is contained in:
Mattt Thompson 2013-02-09 19:36:37 +01:00
parent 2cd283421f
commit caa9551ae4

View file

@ -546,7 +546,7 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {
- (void)cancelAllHTTPOperationsWithMethod:(NSString *)method
path:(NSString *)path
{
NSString *URLStringToMatched = [[[self requestWithMethod:(method ?: @"GET") path:path parameters:nil] URL] absoluteString];
NSString *pathToBeMatched = [[[self requestWithMethod:(method ?: @"GET") path:path parameters:nil] URL] path];
for (NSOperation *operation in [self.operationQueue operations]) {
if (![operation isKindOfClass:[AFHTTPRequestOperation class]]) {
@ -554,9 +554,9 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {
}
BOOL hasMatchingMethod = !method || [method isEqualToString:[[(AFHTTPRequestOperation *)operation request] HTTPMethod]];
BOOL hasMatchingURL = [[[[(AFHTTPRequestOperation *)operation request] URL] absoluteString] isEqualToString:URLStringToMatched];
BOOL hasMatchingPath = [[[[(AFHTTPRequestOperation *)operation request] URL] path] isEqual:pathToBeMatched];
if (hasMatchingMethod && hasMatchingURL) {
if (hasMatchingMethod && hasMatchingPath) {
[operation cancel];
}
}