Skip to content
Snippets Groups Projects
Commit 6512d26b authored by Jorge Canizales's avatar Jorge Canizales
Browse files

Rename requestMetadata -> requestHeaders

parent 2d1e5a1b
No related branches found
No related tags found
No related merge requests found
...@@ -40,7 +40,7 @@ static NSString * const kChallengeHeader = @"www-authenticate"; ...@@ -40,7 +40,7 @@ static NSString * const kChallengeHeader = @"www-authenticate";
@implementation GRPCCall (OAuth2) @implementation GRPCCall (OAuth2)
- (NSString *)oauth2AccessToken { - (NSString *)oauth2AccessToken {
NSString *headerValue = self.requestMetadata[kAuthorizationHeader]; NSString *headerValue = self.requestHeaders[kAuthorizationHeader];
if ([headerValue hasPrefix:kBearerPrefix]) { if ([headerValue hasPrefix:kBearerPrefix]) {
return [headerValue substringFromIndex:kBearerPrefix.length]; return [headerValue substringFromIndex:kBearerPrefix.length];
} else { } else {
...@@ -50,9 +50,9 @@ static NSString * const kChallengeHeader = @"www-authenticate"; ...@@ -50,9 +50,9 @@ static NSString * const kChallengeHeader = @"www-authenticate";
- (void)setOauth2AccessToken:(NSString *)token { - (void)setOauth2AccessToken:(NSString *)token {
if (token) { if (token) {
self.requestMetadata[kAuthorizationHeader] = [kBearerPrefix stringByAppendingString:token]; self.requestHeaders[kAuthorizationHeader] = [kBearerPrefix stringByAppendingString:token];
} else { } else {
[self.requestMetadata removeObjectForKey:kAuthorizationHeader]; [self.requestHeaders removeObjectForKey:kAuthorizationHeader];
} }
} }
......
...@@ -68,8 +68,8 @@ extern id const kGRPCStatusMetadataKey; ...@@ -68,8 +68,8 @@ extern id const kGRPCStatusMetadataKey;
// //
// For convenience, the property is initialized to an empty NSMutableDictionary, and the setter // For convenience, the property is initialized to an empty NSMutableDictionary, and the setter
// accepts (and copies) both mutable and immutable dictionaries. // accepts (and copies) both mutable and immutable dictionaries.
- (NSMutableDictionary *)requestMetadata; // nonatomic - (NSMutableDictionary *)requestHeaders; // nonatomic
- (void)setRequestMetadata:(NSDictionary *)requestMetadata; // nonatomic, copy - (void)setRequestHeaders:(NSDictionary *)requestHeaders; // nonatomic, copy
// This dictionary is populated with the HTTP headers received from the server. When the RPC ends, // This dictionary is populated with the HTTP headers received from the server. When the RPC ends,
// the HTTP trailers received are added to the dictionary too. It has the same structure as the // the HTTP trailers received are added to the dictionary too. It has the same structure as the
......
...@@ -89,7 +89,7 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey"; ...@@ -89,7 +89,7 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey";
// the response arrives. // the response arrives.
GRPCCall *_retainSelf; GRPCCall *_retainSelf;
NSMutableDictionary *_requestMetadata; NSMutableDictionary *_requestHeaders;
NSMutableDictionary *_responseMetadata; NSMutableDictionary *_responseMetadata;
} }
...@@ -121,7 +121,7 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey"; ...@@ -121,7 +121,7 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey";
_requestWriter = requestWriter; _requestWriter = requestWriter;
_requestMetadata = [NSMutableDictionary dictionary]; _requestHeaders = [NSMutableDictionary dictionary];
_responseMetadata = [NSMutableDictionary dictionary]; _responseMetadata = [NSMutableDictionary dictionary];
} }
return self; return self;
...@@ -129,12 +129,12 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey"; ...@@ -129,12 +129,12 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey";
#pragma mark Metadata #pragma mark Metadata
- (NSMutableDictionary *)requestMetadata { - (NSMutableDictionary *)requestHeaders {
return _requestMetadata; return _requestHeaders;
} }
- (void)setRequestMetadata:(NSDictionary *)requestMetadata { - (void)setRequestHeaders:(NSDictionary *)requestHeaders {
_requestMetadata = [NSMutableDictionary dictionaryWithDictionary:requestMetadata]; _requestHeaders = [NSMutableDictionary dictionaryWithDictionary:requestHeaders];
} }
- (NSDictionary *)responseMetadata { - (NSDictionary *)responseMetadata {
...@@ -356,7 +356,7 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey"; ...@@ -356,7 +356,7 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey";
_retainSelf = self; _retainSelf = self;
_responseWriteable = [[GRXConcurrentWriteable alloc] initWithWriteable:writeable]; _responseWriteable = [[GRXConcurrentWriteable alloc] initWithWriteable:writeable];
[self sendHeaders:_requestMetadata]; [self sendHeaders:_requestHeaders];
[self invokeCall]; [self invokeCall];
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment