diff options
-rw-r--r-- | src/objective-c/GRPCClient/GRPCCall+OAuth2.m | 2 | ||||
-rw-r--r-- | src/objective-c/GRPCClient/GRPCCall.h | 2 | ||||
-rw-r--r-- | src/objective-c/GRPCClient/GRPCCall.m | 14 | ||||
-rw-r--r-- | src/objective-c/tests/GRPCClientTests.m | 4 |
4 files changed, 11 insertions, 11 deletions
diff --git a/src/objective-c/GRPCClient/GRPCCall+OAuth2.m b/src/objective-c/GRPCClient/GRPCCall+OAuth2.m index 8e64b8b6ae..7f4fbacbe3 100644 --- a/src/objective-c/GRPCClient/GRPCCall+OAuth2.m +++ b/src/objective-c/GRPCClient/GRPCCall+OAuth2.m @@ -57,7 +57,7 @@ static NSString * const kChallengeHeader = @"www-authenticate"; } - (NSString *)oauth2ChallengeHeader { - return self.responseMetadata[kChallengeHeader]; + return self.allResponseMetadata[kChallengeHeader]; } @end diff --git a/src/objective-c/GRPCClient/GRPCCall.h b/src/objective-c/GRPCClient/GRPCCall.h index 97324cba15..b82febb587 100644 --- a/src/objective-c/GRPCClient/GRPCCall.h +++ b/src/objective-c/GRPCClient/GRPCCall.h @@ -78,7 +78,7 @@ extern id const kGRPCStatusMetadataKey; // The first time this object calls |writeValue| on the writeable passed to |startWithWriteable|, // the |responseMetadata| dictionary already contains the response headers. When it calls // |writesFinishedWithError|, the dictionary contains both the response headers and trailers. -@property(atomic, readonly) NSDictionary *responseMetadata; +@property(atomic, readonly) NSDictionary *allResponseMetadata; // The request writer has to write NSData objects into the provided Writeable. The server will // receive each of those separately and in order. diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index 1065ae735f..9714b67a4c 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -90,7 +90,7 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey"; GRPCCall *_retainSelf; NSMutableDictionary *_requestHeaders; - NSMutableDictionary *_responseMetadata; + NSMutableDictionary *_allResponseMetadata; } @synthesize state = _state; @@ -122,7 +122,7 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey"; _requestWriter = requestWriter; _requestHeaders = [NSMutableDictionary dictionary]; - _responseMetadata = [NSMutableDictionary dictionary]; + _allResponseMetadata = [NSMutableDictionary dictionary]; } return self; } @@ -137,8 +137,8 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey"; _requestHeaders = [NSMutableDictionary dictionaryWithDictionary:requestHeaders]; } -- (NSDictionary *)responseMetadata { - return _responseMetadata; +- (NSDictionary *)allResponseMetadata { + return _allResponseMetadata; } #pragma mark Finish @@ -322,18 +322,18 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey"; // Response headers received. GRPCCall *strongSelf = weakSelf; if (strongSelf) { - [strongSelf->_responseMetadata addEntriesFromDictionary:headers]; + [strongSelf->_allResponseMetadata addEntriesFromDictionary:headers]; [strongSelf startNextRead]; } } completionHandler:^(NSError *error, NSDictionary *trailers) { GRPCCall *strongSelf = weakSelf; if (strongSelf) { - [strongSelf->_responseMetadata addEntriesFromDictionary:trailers]; + [strongSelf->_allResponseMetadata addEntriesFromDictionary:trailers]; if (error) { NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:error.userInfo]; - userInfo[kGRPCStatusMetadataKey] = strongSelf->_responseMetadata; + userInfo[kGRPCStatusMetadataKey] = strongSelf->_allResponseMetadata; error = [NSError errorWithDomain:error.domain code:error.code userInfo:userInfo]; } [strongSelf finishWithError:error]; diff --git a/src/objective-c/tests/GRPCClientTests.m b/src/objective-c/tests/GRPCClientTests.m index f23102988b..38a720bb2d 100644 --- a/src/objective-c/tests/GRPCClientTests.m +++ b/src/objective-c/tests/GRPCClientTests.m @@ -168,11 +168,11 @@ static ProtoMethod *kUnaryCallMethod; } completionHandler:^(NSError *errorOrNil) { XCTAssertNotNil(errorOrNil, @"Finished without error!"); XCTAssertEqual(errorOrNil.code, 16, @"Finished with unexpected error: %@", errorOrNil); - XCTAssertEqualObjects(call.responseMetadata, errorOrNil.userInfo[kGRPCStatusMetadataKey], + XCTAssertEqualObjects(call.allResponseMetadata, errorOrNil.userInfo[kGRPCStatusMetadataKey], @"Metadata in the NSError object and call object differ."); NSString *challengeHeader = call.oauth2ChallengeHeader; XCTAssertGreaterThan(challengeHeader.length, 0, - @"No challenge in response headers %@", call.responseMetadata); + @"No challenge in response headers %@", call.allResponseMetadata); [expectation fulfill]; }]; |