From 637258880afacb00c9daeca4566d4c58a960c608 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Mon, 19 Dec 2011 17:09:09 -0500 Subject: [PATCH] fix a bug when setting a timeout in the HTTP client --- Marshmallows/MMHTTPClient.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marshmallows/MMHTTPClient.m b/Marshmallows/MMHTTPClient.m index 2451a3f..7f49330 100644 --- a/Marshmallows/MMHTTPClient.m +++ b/Marshmallows/MMHTTPClient.m @@ -220,15 +220,15 @@ NSString *JoinURLComponents(NSString *first, va_list args) - (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]; }