Skip to content

Commit

Permalink
fix a bug when setting a timeout in the HTTP client
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonjs committed Dec 19, 2011
1 parent 148221b commit 6372588
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Marshmallows/MMHTTPClient.m
Expand Up @@ -220,15 +220,15 @@ - (MMHTTPRequest *) delete: (NSString *)url then: (MMHTTPCallback)callback
- (MMHTTPRequest *) request: (NSDictionary *)options then: (MMHTTPCallback)callback - (MMHTTPRequest *) request: (NSDictionary *)options then: (MMHTTPCallback)callback
{ {
NSString *url = [options objectForKey: @"url"]; NSString *url = [options objectForKey: @"url"];
NSMutableDictionary *mutableOptions = [options mutableCopy];
if (_baseURL && !([url hasPrefix: @"http:"] || [url hasPrefix: @"https:"])) { if (_baseURL && !([url hasPrefix: @"http:"] || [url hasPrefix: @"https:"])) {
NSMutableDictionary *mutableOptions = [options mutableCopy];
[mutableOptions setObject: [self urlWithPath: url] forKey: @"url"]; [mutableOptions setObject: [self urlWithPath: url] forKey: @"url"];
options = [NSDictionary dictionaryWithDictionary: mutableOptions];
} }
NSUInteger timeout = [[options objectForKey: @"timeout"] unsignedIntValue]; NSUInteger timeout = [[options objectForKey: @"timeout"] unsignedIntValue];
if (timeout == 0) { 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]; return [MMHTTPRequest requestWithOptions: options callback: callback];
} }


Expand Down

0 comments on commit 6372588

Please sign in to comment.