From 1bb284d383ea573abca2f8ecba66af6a8346e612 Mon Sep 17 00:00:00 2001 From: Yash Rajpal <58601732+yash-rajpal@users.noreply.github.com> Date: Fri, 1 Jul 2022 22:43:15 +0530 Subject: [PATCH] [FIX] Undefined headers on API Client (#26083) --- packages/api-client/src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/api-client/src/index.ts b/packages/api-client/src/index.ts index c75b39da3b38..02a40b8a54f9 100644 --- a/packages/api-client/src/index.ts +++ b/packages/api-client/src/index.ts @@ -100,7 +100,7 @@ export class RestClient implements RestClientInterface { console.warn('Endpoint cannot contain query string', endpoint); } const queryParams = this.getParams(params); - return this.send(`${endpoint}${queryParams ? `?${queryParams}` : ''}`, 'GET', options).then(function (response) { + return this.send(`${endpoint}${queryParams ? `?${queryParams}` : ''}`, 'GET', options ?? {}).then(function (response) { return response.json(); }); } @@ -141,7 +141,7 @@ export class RestClient implements RestClientInterface { }; delete: RestClientInterface['delete'] = (endpoint, params, options) => { - return this.send(endpoint, 'DELETE', options).then(function (response) { + return this.send(endpoint, 'DELETE', options ?? {}).then(function (response) { return response.json(); }); };