Skip to content

Commit

Permalink
fix(auth): Remove request body for deleteTenant (#1461)
Browse files Browse the repository at this point in the history
This change reverts #1456, which reverted the original PR #1452.

Corresponding internal bug: b/192387245
  • Loading branch information
lisajian authored Oct 14, 2021
1 parent 79769d0 commit 4bef8fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/auth/auth-api-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1887,12 +1887,14 @@ export abstract class AbstractAuthRequestHandler {
*/
protected invokeRequestHandler(
urlBuilder: AuthResourceUrlBuilder, apiSettings: ApiSettings,
requestData: object, additionalResourceParams?: object): Promise<object> {
requestData: object | undefined, additionalResourceParams?: object): Promise<object> {
return urlBuilder.getUrl(apiSettings.getEndpoint(), additionalResourceParams)
.then((url) => {
// Validate request.
const requestValidator = apiSettings.getRequestValidator();
requestValidator(requestData);
if (requestData) {
const requestValidator = apiSettings.getRequestValidator();
requestValidator(requestData);
}
// Process request.
const req: HttpRequestConfig = {
method: apiSettings.getHttpMethod(),
Expand Down Expand Up @@ -2120,7 +2122,7 @@ export class AuthRequestHandler extends AbstractAuthRequestHandler {
if (!validator.isNonEmptyString(tenantId)) {
return Promise.reject(new FirebaseAuthError(AuthClientErrorCode.INVALID_TENANT_ID));
}
return this.invokeRequestHandler(this.tenantMgmtResourceBuilder, DELETE_TENANT, {}, { tenantId })
return this.invokeRequestHandler(this.tenantMgmtResourceBuilder, DELETE_TENANT, undefined, { tenantId })
.then(() => {
// Return nothing.
});
Expand Down
4 changes: 2 additions & 2 deletions test/unit/auth/auth-api-request.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4547,7 +4547,7 @@ AUTH_REQUEST_HANDLER_TESTS.forEach((handler) => {
return requestHandler.deleteTenant(tenantId)
.then((result) => {
expect(result).to.be.undefined;
expect(stub).to.have.been.calledOnce.and.calledWith(callParams(path, method, {}));
expect(stub).to.have.been.calledOnce.and.calledWith(callParams(path, method, undefined));
});
});

Expand Down Expand Up @@ -4582,7 +4582,7 @@ AUTH_REQUEST_HANDLER_TESTS.forEach((handler) => {
throw new Error('Unexpected success');
}, (error) => {
expect(error).to.deep.include(expectedError);
expect(stub).to.have.been.calledOnce.and.calledWith(callParams(path, method, {}));
expect(stub).to.have.been.calledOnce.and.calledWith(callParams(path, method, undefined));
});
});
});
Expand Down

0 comments on commit 4bef8fa

Please sign in to comment.