replace custom base-URL method with standard NSURL one
This commit is contained in:
parent
f86ac982db
commit
e2f5f86146
1 changed files with 2 additions and 11 deletions
|
|
@ -81,16 +81,6 @@ static NSString * AFBase64EncodedStringFromString(NSString *string) {
|
||||||
return [[[NSString alloc] initWithData:mutableData encoding:NSASCIIStringEncoding] autorelease];
|
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 * AFURLEncodedStringFromString(NSString *string) {
|
||||||
static NSString * const kAFLegalCharactersToBeEscaped = @"?!@#$^&%*+,:;='\"`<>()[]{}/\\|~ ";
|
static NSString * const kAFLegalCharactersToBeEscaped = @"?!@#$^&%*+,:;='\"`<>()[]{}/\\|~ ";
|
||||||
|
|
||||||
|
|
@ -249,7 +239,8 @@ static NSString * AFPropertyListStringFromParameters(NSDictionary *parameters) {
|
||||||
path:(NSString *)path
|
path:(NSString *)path
|
||||||
parameters:(NSDictionary *)parameters
|
parameters:(NSDictionary *)parameters
|
||||||
{
|
{
|
||||||
NSURL *url = AFURLWithPathRelativeToURL(path, self.baseURL);
|
NSURL *url = [NSURL URLWithString:path relativeToURL:self.baseURL];
|
||||||
|
|
||||||
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] initWithURL:url] autorelease];
|
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] initWithURL:url] autorelease];
|
||||||
[request setHTTPMethod:method];
|
[request setHTTPMethod:method];
|
||||||
[request setAllHTTPHeaderFields:self.defaultHeaders];
|
[request setAllHTTPHeaderFields:self.defaultHeaders];
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue