Skip to content

Commit

Permalink
fix(rest-client): send signed API requests with body in Firefox (#508)
Browse files Browse the repository at this point in the history
  • Loading branch information
wreckah committed Jan 12, 2024
1 parent bba88dd commit 6705984
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/rest-client/src/makeApiRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export async function makeApiRequest(
if (!settings.authSchema) {
throw new RestClientError('authSchema is required')
}

const url = getRequestURL(path, query, settings.apiBaseURL)
const requestBody = body && JSON.stringify(body)
const unsignedRequest = new Request(url, {
Expand All @@ -79,10 +80,12 @@ export async function makeApiRequest(
})
})
})

const requestHeaders = await settings.authSchema.getHeaders(unsignedRequest)
const signedRequest = new Request(unsignedRequest, {
headers: requestHeaders,
body: requestBody
const signedRequest = new Request(url, {
method: method,
body: requestBody,
headers: requestHeaders
})

const response = await retryIfFailed(() => fetch(signedRequest), {
Expand Down

0 comments on commit 6705984

Please sign in to comment.