Skip to content
Browse files

replace custom base-URL method with standard NSURL one

  • Loading branch information...
1 parent f86ac98 commit e2f5f86146a5b8b2b0b25a7e7c95b7e81cce67e9 @sco sco committed Nov 1, 2011
Showing with 2 additions and 11 deletions.
  1. +2 −11 AFNetworking/AFHTTPClient.m
View
13 AFNetworking/AFHTTPClient.m
@@ -81,16 +81,6 @@ - (id)initWithStringEncoding:(NSStringEncoding)encoding;
return [[[NSString alloc] initWithData:mutableData encoding:NSASCIIStringEncoding] autorelease];
}
-static NSURL * AFURLWithPathRelativeToURL(NSString *path, NSURL *baseURL) {
- NSURL *url = [baseURL URLByAppendingPathComponent:[path stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"/"]]];
- NSString *URLString = [url absoluteString];
- if ([path hasSuffix:@"/"]) {
- URLString = [URLString stringByAppendingString:@"/"];
- }
-
- return [NSURL URLWithString:URLString];
-}
-
static NSString * AFURLEncodedStringFromString(NSString *string) {
static NSString * const kAFLegalCharactersToBeEscaped = @"?!@#$^&%*+,:;='\"`<>()[]{}/\\|~ ";
@@ -249,7 +239,8 @@ - (NSMutableURLRequest *)requestWithMethod:(NSString *)method
path:(NSString *)path
parameters:(NSDictionary *)parameters
{
- NSURL *url = AFURLWithPathRelativeToURL(path, self.baseURL);
+ NSURL *url = [NSURL URLWithString:path relativeToURL:self.baseURL];
+
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] initWithURL:url] autorelease];
[request setHTTPMethod:method];
[request setAllHTTPHeaderFields:self.defaultHeaders];

0 comments on commit e2f5f86

Please sign in to comment.
Something went wrong with that request. Please try again.