mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-23 20:31:13 +08:00
Merge pull request #953 from dmishe/fix_query_params_base_url
Associate base URL after query parameters
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user