Skip to content

Commit

Permalink
fix: only set fetchOptions.body when body isn't undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
KhafraDev committed Apr 5, 2022
1 parent ecc71a7 commit 405b6f0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/rest/src/lib/RequestManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,12 +415,15 @@ export class RequestManager extends EventEmitter {

const fetchOptions = {
agent: this.agent,
body: finalBody ?? null,
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
headers: { ...(request.headers ?? {}), ...additionalHeaders, ...headers } as Record<string, string>,
method: request.method,
};

if (finalBody !== undefined) {
Reflect.set(fetchOptions, 'body', finalBody);
}

return { url, fetchOptions };
}

Expand Down

0 comments on commit 405b6f0

Please sign in to comment.