Skip to content

fixes request URL #218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Example/Auth/Tests/FIRGetProjectConfigRequestTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,26 @@
#import "FIRGetProjectConfigResponse.h"
#import "FIRFakeBackendRPCIssuer.h"

/** @var kGetProjectConfigEndPoint
@brief The "getProjectConfig" endpoint.
*/
static NSString *const kGetProjectConfigEndPoint = @"getProjectConfig";

/** @var kTestAPIKey
@brief Fake API key used for testing.
*/
static NSString *const kTestAPIKey = @"APIKey";

/** @var kAPIURLFormat
@brief URL format for server API calls.
*/
static NSString *const kAPIURLFormat = @"https://%@/identitytoolkit/v3/relyingparty/%@?key=%@";

/** @var gAPIHost
@brief Host for server API calls.
*/
static NSString *gAPIHost = @"www.googleapis.com";

@interface FIRGetProjectConfigRequestTests : XCTestCase
@end

Expand Down Expand Up @@ -68,6 +83,11 @@ - (void)testGetProjectConfigRequest {
XCTAssertFalse([request containsPostBody]);
// Confirm that the quest has no decoded body as it is get request.
XCTAssertNil(_RPCIssuer.decodedRequest);
NSString *URLString = [NSString stringWithFormat:kAPIURLFormat,
gAPIHost,
kGetProjectConfigEndPoint,
kTestAPIKey];
XCTAssertTrue([URLString isEqualToString:[request requestURL]]);
}

@end
6 changes: 2 additions & 4 deletions Firebase/Auth/Source/RPCs/FIRGetProjectConfigRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ @implementation FIRGetProjectConfigRequest

- (nullable instancetype)initWithRequestConfiguration:
(FIRAuthRequestConfiguration *)requestConfiguration {
NSString *APIKey = requestConfiguration.APIKey;
NSString *getProjectConfigURL =
[NSString stringWithFormat:@"%@?key=%@", kGetProjectConfigEndPoint, APIKey];
return [super initWithEndpoint:getProjectConfigURL requestConfiguration:requestConfiguration];
return [super initWithEndpoint:kGetProjectConfigEndPoint
requestConfiguration:requestConfiguration];
}

- (BOOL)containsPostBody {
Expand Down