Adding AFHTTPClient -setDefaultCredential:
This commit is contained in:
parent
1d243f7794
commit
c6137914fa
2 changed files with 19 additions and 2 deletions
|
|
@ -217,7 +217,8 @@ typedef enum {
|
|||
@param header The HTTP header to set a default value for
|
||||
@param value The value set as default for the specified header, or `nil
|
||||
*/
|
||||
- (void)setDefaultHeader:(NSString *)header value:(NSString *)value;
|
||||
- (void)setDefaultHeader:(NSString *)header
|
||||
value:(NSString *)value;
|
||||
|
||||
/**
|
||||
Sets the "Authorization" HTTP header set in request objects made by the HTTP client to a basic authentication value with Base64-encoded username and password. This overwrites any existing value for this header.
|
||||
|
|
@ -225,7 +226,8 @@ typedef enum {
|
|||
@param username The HTTP basic auth username
|
||||
@param password The HTTP basic auth password
|
||||
*/
|
||||
- (void)setAuthorizationHeaderWithUsername:(NSString *)username password:(NSString *)password;
|
||||
- (void)setAuthorizationHeaderWithUsername:(NSString *)username
|
||||
password:(NSString *)password;
|
||||
|
||||
/**
|
||||
Sets the "Authorization" HTTP header set in request objects made by the HTTP client to a token-based authentication value, such as an OAuth access token. This overwrites any existing value for this header.
|
||||
|
|
@ -234,11 +236,23 @@ typedef enum {
|
|||
*/
|
||||
- (void)setAuthorizationHeaderWithToken:(NSString *)token;
|
||||
|
||||
|
||||
/**
|
||||
Clears any existing value for the "Authorization" HTTP header.
|
||||
*/
|
||||
- (void)clearAuthorizationHeader;
|
||||
|
||||
///-------------------------------
|
||||
/// @name Managing URL Credentials
|
||||
///-------------------------------
|
||||
|
||||
/**
|
||||
Set the default URL credential to be set for request operations.
|
||||
|
||||
@param credential The URL credential
|
||||
*/
|
||||
- (void)setDefaultCredential:(NSURLCredential *)credential;
|
||||
|
||||
///-------------------------------
|
||||
/// @name Creating Request Objects
|
||||
///-------------------------------
|
||||
|
|
|
|||
|
|
@ -179,6 +179,7 @@ NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value) {
|
|||
@property (readwrite, nonatomic) NSURL *baseURL;
|
||||
@property (readwrite, nonatomic) NSMutableArray *registeredHTTPOperationClassNames;
|
||||
@property (readwrite, nonatomic) NSMutableDictionary *defaultHeaders;
|
||||
@property (readwrite, nonatomic) NSURLCredential *defaultCredential;
|
||||
@property (readwrite, nonatomic) NSOperationQueue *operationQueue;
|
||||
#ifdef _SYSTEMCONFIGURATION_H
|
||||
@property (readwrite, nonatomic, assign) AFNetworkReachabilityRef networkReachability;
|
||||
|
|
@ -517,6 +518,8 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {
|
|||
}
|
||||
|
||||
[operation setCompletionBlockWithSuccess:success failure:failure];
|
||||
|
||||
operation.credential = self.defaultCredential;
|
||||
|
||||
return operation;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue