Adding AFHTTPClient -patchPath: convenience method
This commit is contained in:
parent
9dec7d71e4
commit
4f31148101
2 changed files with 25 additions and 0 deletions
|
|
@ -418,6 +418,21 @@ extern NSString * AFQueryStringFromParametersWithEncoding(NSDictionary *paramete
|
||||||
parameters:(NSDictionary *)parameters
|
parameters:(NSDictionary *)parameters
|
||||||
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
|
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
|
||||||
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
|
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates an `AFHTTPRequestOperation` with a `PATCH` request, and enqueues it to the HTTP client's operation queue.
|
||||||
|
|
||||||
|
@param path The path to be appended to the HTTP client's base URL and used as the request URL.
|
||||||
|
@param parameters The parameters to be encoded and set in the request HTTP body.
|
||||||
|
@param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the created request operation and the object created from the response data of request.
|
||||||
|
@param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the resonse data. This block has no return value and takes two arguments:, the created request operation and the `NSError` object describing the network or parsing error that occurred.
|
||||||
|
|
||||||
|
@see HTTPRequestOperationWithRequest:success:failure
|
||||||
|
*/
|
||||||
|
- (void)patchPath:(NSString *)path
|
||||||
|
parameters:(NSDictionary *)parameters
|
||||||
|
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
|
||||||
|
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
|
||||||
|
|
@ -513,6 +513,16 @@ static void AFReachabilityCallback(SCNetworkReachabilityRef __unused target, SCN
|
||||||
[self enqueueHTTPRequestOperation:operation];
|
[self enqueueHTTPRequestOperation:operation];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)patchPath:(NSString *)path
|
||||||
|
parameters:(NSDictionary *)parameters
|
||||||
|
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
|
||||||
|
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
|
||||||
|
{
|
||||||
|
NSURLRequest *request = [self requestWithMethod:@"PATCH" path:path parameters:parameters];
|
||||||
|
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure];
|
||||||
|
[self enqueueHTTPRequestOperation:operation];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue