initWithBaseURL

Fixes 446. If the URL passed into initWithBaseURL is a file URL rather
than a directory URL we will fix it.

Without this fix, if you provide "http://myhost/api" as a baseURL and
try to get "path", AFNetworking will get http://myhost/path instead of
http://myhost/api/path. With the fix, we'll change http://myhost/api to
http://myhost/api/.
This commit is contained in:
Steven Fisher 2012-08-08 11:07:20 -07:00
parent bff368c096
commit f849627f9a

View file

@ -254,6 +254,9 @@ static NSString * AFPropertyListStringFromParameters(NSDictionary *parameters) {
return nil;
}
if ( [[url path] length] > 0 && ![[url absoluteString] hasSuffix: @"/"] ) {
url = [url URLByAppendingPathComponent: @""];
}
self.baseURL = url;
self.stringEncoding = NSUTF8StringEncoding;