mirror of
https://github.com/samsonjs/Marshmallows.git
synced 2026-04-27 15:07:42 +00:00
fix a bug when setting a timeout in the HTTP client
This commit is contained in:
parent
148221bcf9
commit
637258880a
1 changed files with 3 additions and 3 deletions
|
|
@ -220,15 +220,15 @@ NSString *JoinURLComponents(NSString *first, va_list args)
|
||||||
- (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];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue