Skip to content

Commit

Permalink
Revert "Remove request body for deleteTenant (firebase#1452)" (fireba…
Browse files Browse the repository at this point in the history
…se#1456)

This reverts commit 475927c.
  • Loading branch information
hiranya911 authored Oct 12, 2021
1 parent 475927c commit 9869334
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions src/auth/auth-api-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1827,14 +1827,12 @@ export abstract class AbstractAuthRequestHandler {
*/
protected invokeRequestHandler(
urlBuilder: AuthResourceUrlBuilder, apiSettings: ApiSettings,
requestData: object | undefined, additionalResourceParams?: object): Promise<object> {
requestData: object, additionalResourceParams?: object): Promise<object> {
return urlBuilder.getUrl(apiSettings.getEndpoint(), additionalResourceParams)
.then((url) => {
// Validate request.
if (requestData != null) {
const requestValidator = apiSettings.getRequestValidator();
requestValidator(requestData);
}
const requestValidator = apiSettings.getRequestValidator();
requestValidator(requestData);
// Process request.
const req: HttpRequestConfig = {
method: apiSettings.getHttpMethod(),
Expand Down Expand Up @@ -2062,7 +2060,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, undefined, { tenantId })
return this.invokeRequestHandler(this.tenantMgmtResourceBuilder, DELETE_TENANT, {}, { 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 @@ -4554,7 +4554,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, undefined));
expect(stub).to.have.been.calledOnce.and.calledWith(callParams(path, method, {}));
});
});

Expand Down Expand Up @@ -4589,7 +4589,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, undefined));
expect(stub).to.have.been.calledOnce.and.calledWith(callParams(path, method, {}));
});
});
});
Expand Down

0 comments on commit 9869334

Please sign in to comment.