Skip to content

Commit 8104b90

Browse files
authored
Fixing a response parse error in IID delete API (#723)
1 parent 0013c06 commit 8104b90

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/instance-id/instance-id-request.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class FirebaseInstanceIdRequestHandler {
6262
this.path = FIREBASE_IID_PATH + `project/${projectId}/instanceId/`;
6363
}
6464

65-
public deleteInstanceId(instanceId: string): Promise<object> {
65+
public deleteInstanceId(instanceId: string): Promise<void> {
6666
if (!validator.isNonEmptyString(instanceId)) {
6767
return Promise.reject(new FirebaseInstanceIdError(
6868
InstanceIdClientErrorCode.INVALID_INSTANCE_ID,
@@ -76,9 +76,9 @@ export class FirebaseInstanceIdRequestHandler {
7676
* Invokes the request handler based on the API settings object passed.
7777
*
7878
* @param {ApiSettings} apiSettings The API endpoint settings to apply to request and response.
79-
* @return {Promise<object>} A promise that resolves with the response.
79+
* @return {Promise<void>} A promise that resolves when the request is complete.
8080
*/
81-
private invokeRequestHandler(apiSettings: ApiSettings): Promise<object> {
81+
private invokeRequestHandler(apiSettings: ApiSettings): Promise<void> {
8282
const path: string = this.path + apiSettings.getEndpoint();
8383
return Promise.resolve()
8484
.then(() => {
@@ -90,7 +90,7 @@ export class FirebaseInstanceIdRequestHandler {
9090
return this.httpClient.send(req);
9191
})
9292
.then((response) => {
93-
return response.data;
93+
// return nothing on success
9494
})
9595
.catch((err) => {
9696
if (err instanceof HttpError) {

test/unit/instance-id/instance-id-request.spec.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,13 @@ describe('FirebaseInstanceIdRequestHandler', () => {
8080
const timeout = 10000;
8181

8282
it('should be fulfilled given a valid instance ID', () => {
83-
const expectedResult = {};
8483
const stub = sinon.stub(HttpClient.prototype, 'send')
85-
.resolves(utils.responseFrom(expectedResult));
84+
.resolves(utils.responseFrom(''));
8685
stubs.push(stub);
8786

8887
const requestHandler = new FirebaseInstanceIdRequestHandler(mockApp, projectId);
8988
return requestHandler.deleteInstanceId('test-iid')
90-
.then((result) => {
91-
expect(result).to.deep.equal(expectedResult);
89+
.then(() => {
9290
expect(stub).to.have.been.calledOnce.and.calledWith({
9391
method: httpMethod,
9492
url: `https://${host}${path}`,

0 commit comments

Comments
 (0)