Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/drivers/routerlicious-driver/src/restWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ const buildRequestUrl = (requestConfig: AxiosRequestConfig) =>
const axiosBuildRequestInitConfig = (requestConfig: AxiosRequestConfig): RequestInit => {
const requestInit: RequestInit = {
method: requestConfig.method,
// NOTE: I believe that although the Axios type permits non-string values in the header, here we are
// guaranteed the requestConfig only has string values in its header.
headers: requestConfig.headers as Record<string, string>,
body: requestConfig.data,
// Only set headers if they exist to avoid passing undefined
...(requestConfig.headers && { headers: requestConfig.headers as Record<string, string> }),
// Only set body if it exists to avoid passing undefined
...(requestConfig.data !== undefined && { body: requestConfig.data }),
};
return requestInit;
};
Expand Down