Permalink
Browse files

fix a bug when setting a timeout in the HTTP client

  • Loading branch information...
1 parent 148221b commit 637258880afacb00c9daeca4566d4c58a960c608 @samsonjs committed Dec 19, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 Marshmallows/MMHTTPClient.m
View
6 Marshmallows/MMHTTPClient.m
@@ -220,15 +220,15 @@ - (MMHTTPRequest *) delete: (NSString *)url then: (MMHTTPCallback)callback
- (MMHTTPRequest *) request: (NSDictionary *)options then: (MMHTTPCallback)callback
{
NSString *url = [options objectForKey: @"url"];
+ NSMutableDictionary *mutableOptions = [options mutableCopy];
if (_baseURL && !([url hasPrefix: @"http:"] || [url hasPrefix: @"https:"])) {
- NSMutableDictionary *mutableOptions = [options mutableCopy];
[mutableOptions setObject: [self urlWithPath: url] forKey: @"url"];
- options = [NSDictionary dictionaryWithDictionary: mutableOptions];
}
NSUInteger timeout = [[options objectForKey: @"timeout"] unsignedIntValue];
if (timeout == 0) {
- [options setValue: [NSNumber numberWithUnsignedInt: self.timeout] forKey: @"timeout"];
+ [mutableOptions setValue: [NSNumber numberWithUnsignedInt: self.timeout] forKey: @"timeout"];
}
+ options = [NSDictionary dictionaryWithDictionary: mutableOptions];
return [MMHTTPRequest requestWithOptions: options callback: callback];
}

0 comments on commit 6372588

Please sign in to comment.