Rename requestMetadata -> requestHeaders

pull/2914/head
Jorge Canizales 9 years ago
parent 2d1e5a1b26
commit 6512d26b1b
  1. 6
      src/objective-c/GRPCClient/GRPCCall+OAuth2.m
  2. 4
      src/objective-c/GRPCClient/GRPCCall.h
  3. 14
      src/objective-c/GRPCClient/GRPCCall.m

@ -40,7 +40,7 @@ static NSString * const kChallengeHeader = @"www-authenticate";
@implementation GRPCCall (OAuth2)
- (NSString *)oauth2AccessToken {
NSString *headerValue = self.requestMetadata[kAuthorizationHeader];
NSString *headerValue = self.requestHeaders[kAuthorizationHeader];
if ([headerValue hasPrefix:kBearerPrefix]) {
return [headerValue substringFromIndex:kBearerPrefix.length];
} else {
@ -50,9 +50,9 @@ static NSString * const kChallengeHeader = @"www-authenticate";
- (void)setOauth2AccessToken:(NSString *)token {
if (token) {
self.requestMetadata[kAuthorizationHeader] = [kBearerPrefix stringByAppendingString:token];
self.requestHeaders[kAuthorizationHeader] = [kBearerPrefix stringByAppendingString:token];
} else {
[self.requestMetadata removeObjectForKey:kAuthorizationHeader];
[self.requestHeaders removeObjectForKey:kAuthorizationHeader];
}
}

@ -68,8 +68,8 @@ extern id const kGRPCStatusMetadataKey;
//
// For convenience, the property is initialized to an empty NSMutableDictionary, and the setter
// accepts (and copies) both mutable and immutable dictionaries.
- (NSMutableDictionary *)requestMetadata; // nonatomic
- (void)setRequestMetadata:(NSDictionary *)requestMetadata; // nonatomic, copy
- (NSMutableDictionary *)requestHeaders; // nonatomic
- (void)setRequestHeaders:(NSDictionary *)requestHeaders; // nonatomic, copy
// 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

@ -89,7 +89,7 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey";
// the response arrives.
GRPCCall *_retainSelf;
NSMutableDictionary *_requestMetadata;
NSMutableDictionary *_requestHeaders;
NSMutableDictionary *_responseMetadata;
}
@ -121,7 +121,7 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey";
_requestWriter = requestWriter;
_requestMetadata = [NSMutableDictionary dictionary];
_requestHeaders = [NSMutableDictionary dictionary];
_responseMetadata = [NSMutableDictionary dictionary];
}
return self;
@ -129,12 +129,12 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey";
#pragma mark Metadata
- (NSMutableDictionary *)requestMetadata {
return _requestMetadata;
- (NSMutableDictionary *)requestHeaders {
return _requestHeaders;
}
- (void)setRequestMetadata:(NSDictionary *)requestMetadata {
_requestMetadata = [NSMutableDictionary dictionaryWithDictionary:requestMetadata];
- (void)setRequestHeaders:(NSDictionary *)requestHeaders {
_requestHeaders = [NSMutableDictionary dictionaryWithDictionary:requestHeaders];
}
- (NSDictionary *)responseMetadata {
@ -356,7 +356,7 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey";
_retainSelf = self;
_responseWriteable = [[GRXConcurrentWriteable alloc] initWithWriteable:writeable];
[self sendHeaders:_requestMetadata];
[self sendHeaders:_requestHeaders];
[self invokeCall];
}

Loading…
Cancel
Save