Browse Source

Loop over only changed keypaths in request serializer (#4581)

Elf Sundae 5 years ago
parent
commit
852ec56707
1 changed files with 2 additions and 4 deletions
  1. 2 4
      AFNetworking/AFURLRequestSerialization.m

+ 2 - 4
AFNetworking/AFURLRequestSerialization.m

@@ -368,10 +368,8 @@ forHTTPHeaderField:(NSString *)field
     NSMutableURLRequest *mutableRequest = [[NSMutableURLRequest alloc] initWithURL:url];
     NSMutableURLRequest *mutableRequest = [[NSMutableURLRequest alloc] initWithURL:url];
     mutableRequest.HTTPMethod = method;
     mutableRequest.HTTPMethod = method;
 
 
-    for (NSString *keyPath in AFHTTPRequestSerializerObservedKeyPaths()) {
-        if ([self.mutableObservedChangedKeyPaths containsObject:keyPath]) {
-            [mutableRequest setValue:[self valueForKeyPath:keyPath] forKey:keyPath];
-        }
+    for (NSString *keyPath in self.mutableObservedChangedKeyPaths) {
+        [mutableRequest setValue:[self valueForKeyPath:keyPath] forKey:keyPath];
     }
     }
 
 
     mutableRequest = [[self requestBySerializingRequest:mutableRequest withParameters:parameters error:error] mutableCopy];
     mutableRequest = [[self requestBySerializingRequest:mutableRequest withParameters:parameters error:error] mutableCopy];