Skip to content

Commit 772071c

Browse files
committed
Remove request body for deleteTenant (firebase#1452)
1 parent 9ab37f5 commit 772071c

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/auth/auth-api-request.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,12 +1887,14 @@ export abstract class AbstractAuthRequestHandler {
18871887
*/
18881888
protected invokeRequestHandler(
18891889
urlBuilder: AuthResourceUrlBuilder, apiSettings: ApiSettings,
1890-
requestData: object, additionalResourceParams?: object): Promise<object> {
1890+
requestData: object | undefined, additionalResourceParams?: object): Promise<object> {
18911891
return urlBuilder.getUrl(apiSettings.getEndpoint(), additionalResourceParams)
18921892
.then((url) => {
18931893
// Validate request.
1894-
const requestValidator = apiSettings.getRequestValidator();
1895-
requestValidator(requestData);
1894+
if (requestData != null) {
1895+
const requestValidator = apiSettings.getRequestValidator();
1896+
requestValidator(requestData);
1897+
}
18961898
// Process request.
18971899
const req: HttpRequestConfig = {
18981900
method: apiSettings.getHttpMethod(),
@@ -2120,7 +2122,7 @@ export class AuthRequestHandler extends AbstractAuthRequestHandler {
21202122
if (!validator.isNonEmptyString(tenantId)) {
21212123
return Promise.reject(new FirebaseAuthError(AuthClientErrorCode.INVALID_TENANT_ID));
21222124
}
2123-
return this.invokeRequestHandler(this.tenantMgmtResourceBuilder, DELETE_TENANT, {}, { tenantId })
2125+
return this.invokeRequestHandler(this.tenantMgmtResourceBuilder, DELETE_TENANT, undefined, { tenantId })
21242126
.then(() => {
21252127
// Return nothing.
21262128
});

test/unit/auth/auth-api-request.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4547,7 +4547,7 @@ AUTH_REQUEST_HANDLER_TESTS.forEach((handler) => {
45474547
return requestHandler.deleteTenant(tenantId)
45484548
.then((result) => {
45494549
expect(result).to.be.undefined;
4550-
expect(stub).to.have.been.calledOnce.and.calledWith(callParams(path, method, {}));
4550+
expect(stub).to.have.been.calledOnce.and.calledWith(callParams(path, method, undefined));
45514551
});
45524552
});
45534553

@@ -4582,7 +4582,7 @@ AUTH_REQUEST_HANDLER_TESTS.forEach((handler) => {
45824582
throw new Error('Unexpected success');
45834583
}, (error) => {
45844584
expect(error).to.deep.include(expectedError);
4585-
expect(stub).to.have.been.calledOnce.and.calledWith(callParams(path, method, {}));
4585+
expect(stub).to.have.been.calledOnce.and.calledWith(callParams(path, method, undefined));
45864586
});
45874587
});
45884588
});

0 commit comments

Comments
 (0)