Rename responseMetadata -> allResponseMetadata

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

@ -57,7 +57,7 @@ static NSString * const kChallengeHeader = @"www-authenticate";
}
- (NSString *)oauth2ChallengeHeader {
return self.responseMetadata[kChallengeHeader];
return self.allResponseMetadata[kChallengeHeader];
}
@end

@ -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.

@ -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];

@ -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];
}];

Loading…
Cancel
Save