From 72ffb33e5cb0cb2bb36a9e94196b6c4fead26d48 Mon Sep 17 00:00:00 2001 From: Elise Alix Date: Wed, 24 Aug 2022 17:13:09 -0400 Subject: [PATCH] fix: Pass Headers to publish to fix Android's fetch --- src/ApiClient.ts | 2 +- test/ApiClient.test.ts | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ApiClient.ts b/src/ApiClient.ts index f56ae4d34..4766f7388 100644 --- a/src/ApiClient.ts +++ b/src/ApiClient.ts @@ -109,7 +109,7 @@ export default class ApiClient { { pathPrefix: this.pathPrefix, mode: 'cors', - headers: { Authorization: `Bearer ${authToken}` }, + headers: new Headers({ Authorization: `Bearer ${authToken}` }), }, ], this.maxRetries, diff --git a/test/ApiClient.test.ts b/test/ApiClient.test.ts index 82984b8b7..ab3238aa1 100644 --- a/test/ApiClient.test.ts +++ b/test/ApiClient.test.ts @@ -154,9 +154,7 @@ describe('Publish', () => { expect(publishMock).toHaveBeenCalledWith(expectedRequest, { pathPrefix: PATH_PREFIX, mode: 'cors', - headers: { - Authorization: `Bearer ${AUTH_TOKEN}`, - }, + headers: new Headers({ Authorization: `Bearer ${AUTH_TOKEN}` }), }) })