Skip to content

Commit 475927c

Browse files
authored
Remove request body for deleteTenant (#1452)
1 parent 137905c commit 475927c

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
@@ -1827,12 +1827,14 @@ export abstract class AbstractAuthRequestHandler {
18271827
*/
18281828
protected invokeRequestHandler(
18291829
urlBuilder: AuthResourceUrlBuilder, apiSettings: ApiSettings,
1830-
requestData: object, additionalResourceParams?: object): Promise<object> {
1830+
requestData: object | undefined, additionalResourceParams?: object): Promise<object> {
18311831
return urlBuilder.getUrl(apiSettings.getEndpoint(), additionalResourceParams)
18321832
.then((url) => {
18331833
// Validate request.
1834-
const requestValidator = apiSettings.getRequestValidator();
1835-
requestValidator(requestData);
1834+
if (requestData != null) {
1835+
const requestValidator = apiSettings.getRequestValidator();
1836+
requestValidator(requestData);
1837+
}
18361838
// Process request.
18371839
const req: HttpRequestConfig = {
18381840
method: apiSettings.getHttpMethod(),
@@ -2060,7 +2062,7 @@ export class AuthRequestHandler extends AbstractAuthRequestHandler {
20602062
if (!validator.isNonEmptyString(tenantId)) {
20612063
return Promise.reject(new FirebaseAuthError(AuthClientErrorCode.INVALID_TENANT_ID));
20622064
}
2063-
return this.invokeRequestHandler(this.tenantMgmtResourceBuilder, DELETE_TENANT, {}, { tenantId })
2065+
return this.invokeRequestHandler(this.tenantMgmtResourceBuilder, DELETE_TENANT, undefined, { tenantId })
20642066
.then(() => {
20652067
// Return nothing.
20662068
});

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4554,7 +4554,7 @@ AUTH_REQUEST_HANDLER_TESTS.forEach((handler) => {
45544554
return requestHandler.deleteTenant(tenantId)
45554555
.then((result) => {
45564556
expect(result).to.be.undefined;
4557-
expect(stub).to.have.been.calledOnce.and.calledWith(callParams(path, method, {}));
4557+
expect(stub).to.have.been.calledOnce.and.calledWith(callParams(path, method, undefined));
45584558
});
45594559
});
45604560

@@ -4589,7 +4589,7 @@ AUTH_REQUEST_HANDLER_TESTS.forEach((handler) => {
45894589
throw new Error('Unexpected success');
45904590
}, (error) => {
45914591
expect(error).to.deep.include(expectedError);
4592-
expect(stub).to.have.been.calledOnce.and.calledWith(callParams(path, method, {}));
4592+
expect(stub).to.have.been.calledOnce.and.calledWith(callParams(path, method, undefined));
45934593
});
45944594
});
45954595
});

0 commit comments

Comments
 (0)