Merge pull request #953 from dmishe/fix_query_params_base_url

Associate base URL after query parameters
This commit is contained in:
Blake Watters
2012-09-28 14:17:28 -07:00

View File

@@ -211,11 +211,6 @@ NSURL *RKBaseURLAssociatedWithURL(NSURL *URL)
[request setAllHTTPHeaderFields:self.HTTPClient.defaultHeaders];
if (self.acceptHeaderValue) [request setValue:self.acceptHeaderValue forHTTPHeaderField:@"Accept"];
/**
Associate our baseURL with the URL of the `NSURLRequest` object. This enables us to match response descriptors by path.
*/
RKAssociateBaseURLWithURL(self.HTTPClient.baseURL, request.URL);
if (parameters) {
if ([method isEqualToString:@"GET"] || [method isEqualToString:@"HEAD"] || [method isEqualToString:@"DELETE"]) {
url = [NSURL URLWithString:[[url absoluteString] stringByAppendingFormat:[path rangeOfString:@"?"].location == NSNotFound ? @"?%@" : @"&%@", AFQueryStringFromParametersWithEncoding(parameters, self.HTTPClient.stringEncoding)]];
@@ -229,6 +224,11 @@ NSURL *RKBaseURLAssociatedWithURL(NSURL *URL)
}
}
/**
Associate our baseURL with the URL of the `NSURLRequest` object. This enables us to match response descriptors by path.
*/
RKAssociateBaseURLWithURL(self.HTTPClient.baseURL, request.URL);
return request;
}
- (NSMutableURLRequest *)requestWithPathForRouteNamed:(NSString *)routeName