Skip to content

Commit e812581

Browse files
authored
fixes request URL (firebase#218)
1 parent 11a4a4f commit e812581

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

Example/Auth/Tests/FIRGetProjectConfigRequestTests.m

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,26 @@
2121
#import "FIRGetProjectConfigResponse.h"
2222
#import "FIRFakeBackendRPCIssuer.h"
2323

24+
/** @var kGetProjectConfigEndPoint
25+
@brief The "getProjectConfig" endpoint.
26+
*/
27+
static NSString *const kGetProjectConfigEndPoint = @"getProjectConfig";
28+
2429
/** @var kTestAPIKey
2530
@brief Fake API key used for testing.
2631
*/
2732
static NSString *const kTestAPIKey = @"APIKey";
2833

34+
/** @var kAPIURLFormat
35+
@brief URL format for server API calls.
36+
*/
37+
static NSString *const kAPIURLFormat = @"https://%@/identitytoolkit/v3/relyingparty/%@?key=%@";
38+
39+
/** @var gAPIHost
40+
@brief Host for server API calls.
41+
*/
42+
static NSString *gAPIHost = @"www.googleapis.com";
43+
2944
@interface FIRGetProjectConfigRequestTests : XCTestCase
3045
@end
3146

@@ -68,6 +83,11 @@ - (void)testGetProjectConfigRequest {
6883
XCTAssertFalse([request containsPostBody]);
6984
// Confirm that the quest has no decoded body as it is get request.
7085
XCTAssertNil(_RPCIssuer.decodedRequest);
86+
NSString *URLString = [NSString stringWithFormat:kAPIURLFormat,
87+
gAPIHost,
88+
kGetProjectConfigEndPoint,
89+
kTestAPIKey];
90+
XCTAssertTrue([URLString isEqualToString:[request requestURL]]);
7191
}
7292

7393
@end

Firebase/Auth/Source/RPCs/FIRGetProjectConfigRequest.m

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ @implementation FIRGetProjectConfigRequest
2727

2828
- (nullable instancetype)initWithRequestConfiguration:
2929
(FIRAuthRequestConfiguration *)requestConfiguration {
30-
NSString *APIKey = requestConfiguration.APIKey;
31-
NSString *getProjectConfigURL =
32-
[NSString stringWithFormat:@"%@?key=%@", kGetProjectConfigEndPoint, APIKey];
33-
return [super initWithEndpoint:getProjectConfigURL requestConfiguration:requestConfiguration];
30+
return [super initWithEndpoint:kGetProjectConfigEndPoint
31+
requestConfiguration:requestConfiguration];
3432
}
3533

3634
- (BOOL)containsPostBody {

0 commit comments

Comments
 (0)