Skip to content

Commit

Permalink
fix: Pass Headers to publish to fix Android's fetch (#153)
Browse files Browse the repository at this point in the history
This resolves an issue with React Native's fetch API specific to Android.
  • Loading branch information
Elise Alix authored Aug 24, 2022
2 parents 5bb4304 + 72ffb33 commit 83d4d4b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/ApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions test/ApiClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}` }),
})
})

Expand Down

0 comments on commit 83d4d4b

Please sign in to comment.