Adding requirement that method not be nil in requestWithMethod:path:parameters
Defaulting path to blank string if nil
This commit is contained in:
parent
07270cd20c
commit
30aeb09d2f
2 changed files with 9 additions and 3 deletions
|
|
@ -239,10 +239,10 @@ typedef enum {
|
|||
/**
|
||||
Creates an `NSMutableURLRequest` object with the specified HTTP method and path.
|
||||
|
||||
If the HTTP method is `GET`, the parameters will be used to construct a url-encoded query string that is appended to the request's URL. Otherwise, the parameters will be encoded according to the value of the `parameterEncoding` property, and set as the request body.
|
||||
If the HTTP method is `GET`, `HEAD`, or `DELETE`, the parameters will be used to construct a url-encoded query string that is appended to the request's URL. Otherwise, the parameters will be encoded according to the value of the `parameterEncoding` property, and set as the request body.
|
||||
|
||||
@param method The HTTP method for the request, such as `GET`, `POST`, `PUT`, or `DELETE`.
|
||||
@param path The path to be appended to the HTTP client's base URL and used as the request URL.
|
||||
@param method The HTTP method for the request, such as `GET`, `POST`, `PUT`, or `DELETE`. This parameter must not be `nil`.
|
||||
@param path The path to be appended to the HTTP client's base URL and used as the request URL. If `nil`, no path will be appended to the base URL.
|
||||
@param parameters The parameters to be either set as a query string for `GET` requests, or the request HTTP body.
|
||||
|
||||
@return An `NSMutableURLRequest` object
|
||||
|
|
|
|||
|
|
@ -423,6 +423,12 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {}
|
|||
path:(NSString *)path
|
||||
parameters:(NSDictionary *)parameters
|
||||
{
|
||||
NSCParameterAssert(method);
|
||||
|
||||
if (!path) {
|
||||
path = @"";
|
||||
}
|
||||
|
||||
NSURL *url = [NSURL URLWithString:path relativeToURL:self.baseURL];
|
||||
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
|
||||
[request setHTTPMethod:method];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue