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

Rename oauth2_lowerCamel -> oauth2UpperCamel

parent 26e0c9ee
No related branches found
No related tags found
No related merge requests found
...@@ -41,9 +41,9 @@ ...@@ -41,9 +41,9 @@
// authorization header from the request. // authorization header from the request.
// The value obtained by getting the property is the OAuth2 bearer token if the authorization header // 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. // 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). // 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 @end
...@@ -39,7 +39,7 @@ static NSString * const kChallengeHeader = @"www-authenticate"; ...@@ -39,7 +39,7 @@ static NSString * const kChallengeHeader = @"www-authenticate";
@implementation GRPCCall (OAuth2) @implementation GRPCCall (OAuth2)
- (NSString *)oauth2_accessToken { - (NSString *)oauth2AccessToken {
NSString *headerValue = self.requestMetadata[kAuthorizationHeader]; NSString *headerValue = self.requestMetadata[kAuthorizationHeader];
if ([headerValue hasPrefix:kBearerPrefix]) { if ([headerValue hasPrefix:kBearerPrefix]) {
return [headerValue substringFromIndex:kBearerPrefix.length]; return [headerValue substringFromIndex:kBearerPrefix.length];
...@@ -48,7 +48,7 @@ static NSString * const kChallengeHeader = @"www-authenticate"; ...@@ -48,7 +48,7 @@ static NSString * const kChallengeHeader = @"www-authenticate";
} }
} }
- (void)setOauth2_accessToken:(NSString *)token { - (void)setOauth2AccessToken:(NSString *)token {
if (token) { if (token) {
self.requestMetadata[kAuthorizationHeader] = [kBearerPrefix stringByAppendingString:token]; self.requestMetadata[kAuthorizationHeader] = [kBearerPrefix stringByAppendingString:token];
} else { } else {
...@@ -56,7 +56,7 @@ static NSString * const kChallengeHeader = @"www-authenticate"; ...@@ -56,7 +56,7 @@ static NSString * const kChallengeHeader = @"www-authenticate";
} }
} }
- (NSString *)oauth2_challengeHeader { - (NSString *)oauth2ChallengeHeader {
return self.responseMetadata[kChallengeHeader]; return self.responseMetadata[kChallengeHeader];
} }
......
...@@ -161,7 +161,7 @@ static ProtoMethod *kUnaryCallMethod; ...@@ -161,7 +161,7 @@ static ProtoMethod *kUnaryCallMethod;
path:kUnaryCallMethod.HTTPPath path:kUnaryCallMethod.HTTPPath
requestsWriter:requestsWriter]; requestsWriter:requestsWriter];
call.oauth2_accessToken = @"bogusToken"; call.oauth2AccessToken = @"bogusToken";
id<GRXWriteable> responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) { id<GRXWriteable> responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) {
XCTFail(@"Received unexpected response: %@", value); XCTFail(@"Received unexpected response: %@", value);
...@@ -170,7 +170,7 @@ static ProtoMethod *kUnaryCallMethod; ...@@ -170,7 +170,7 @@ static ProtoMethod *kUnaryCallMethod;
XCTAssertEqual(errorOrNil.code, 16, @"Finished with unexpected error: %@", errorOrNil); XCTAssertEqual(errorOrNil.code, 16, @"Finished with unexpected error: %@", errorOrNil);
XCTAssertEqualObjects(call.responseMetadata, errorOrNil.userInfo[kGRPCStatusMetadataKey], XCTAssertEqualObjects(call.responseMetadata, errorOrNil.userInfo[kGRPCStatusMetadataKey],
@"Metadata in the NSError object and call object differ."); @"Metadata in the NSError object and call object differ.");
NSString *challengeHeader = call.oauth2_challengeHeader; NSString *challengeHeader = call.oauth2ChallengeHeader;
XCTAssertGreaterThan(challengeHeader.length, 0, XCTAssertGreaterThan(challengeHeader.length, 0,
@"No challenge in response headers %@", call.responseMetadata); @"No challenge in response headers %@", call.responseMetadata);
[expectation fulfill]; [expectation fulfill];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment