Rename oauth2_lowerCamel -> oauth2UpperCamel

pull/2838/head
Jorge Canizales 9 years ago
parent 26e0c9ee4c
commit 721b7a3923
  1. 4
      src/objective-c/GRPCClient/GRPCCall+OAuth2.h
  2. 6
      src/objective-c/GRPCClient/GRPCCall+OAuth2.m
  3. 4
      src/objective-c/tests/GRPCClientTests.m

@ -41,9 +41,9 @@
// authorization header from the request.
// The value obtained by getting the property is the OAuth2 bearer token if the authorization header
// of the request has the form "Bearer <token>", or nil otherwise.
@property(atomic, copy) NSString *oauth2_accessToken;
@property(atomic, copy) NSString *oauth2AccessToken;
// Returns the value (if any) of the "www-authenticate" response header (the challenge header).
@property(atomic, readonly) NSString *oauth2_challengeHeader;
@property(atomic, readonly) NSString *oauth2ChallengeHeader;
@end

@ -39,7 +39,7 @@ static NSString * const kChallengeHeader = @"www-authenticate";
@implementation GRPCCall (OAuth2)
- (NSString *)oauth2_accessToken {
- (NSString *)oauth2AccessToken {
NSString *headerValue = self.requestMetadata[kAuthorizationHeader];
if ([headerValue hasPrefix:kBearerPrefix]) {
return [headerValue substringFromIndex:kBearerPrefix.length];
@ -48,7 +48,7 @@ static NSString * const kChallengeHeader = @"www-authenticate";
}
}
- (void)setOauth2_accessToken:(NSString *)token {
- (void)setOauth2AccessToken:(NSString *)token {
if (token) {
self.requestMetadata[kAuthorizationHeader] = [kBearerPrefix stringByAppendingString:token];
} else {
@ -56,7 +56,7 @@ static NSString * const kChallengeHeader = @"www-authenticate";
}
}
- (NSString *)oauth2_challengeHeader {
- (NSString *)oauth2ChallengeHeader {
return self.responseMetadata[kChallengeHeader];
}

@ -161,7 +161,7 @@ static ProtoMethod *kUnaryCallMethod;
path:kUnaryCallMethod.HTTPPath
requestsWriter:requestsWriter];
call.oauth2_accessToken = @"bogusToken";
call.oauth2AccessToken = @"bogusToken";
id<GRXWriteable> responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) {
XCTFail(@"Received unexpected response: %@", value);
@ -170,7 +170,7 @@ static ProtoMethod *kUnaryCallMethod;
XCTAssertEqual(errorOrNil.code, 16, @"Finished with unexpected error: %@", errorOrNil);
XCTAssertEqualObjects(call.responseMetadata, errorOrNil.userInfo[kGRPCStatusMetadataKey],
@"Metadata in the NSError object and call object differ.");
NSString *challengeHeader = call.oauth2_challengeHeader;
NSString *challengeHeader = call.oauth2ChallengeHeader;
XCTAssertGreaterThan(challengeHeader.length, 0,
@"No challenge in response headers %@", call.responseMetadata);
[expectation fulfill];

Loading…
Cancel
Save