Skip to content

Commit ad56877

Browse files
committed
fixes custom headers implementation
1 parent 000e6ca commit ad56877

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

gusto_embedded/src/ReactSDKProvider.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,14 @@ export function ReactSDKProvider({
1717
}) {
1818
const httpClientWithHeaders = new HTTPClient({
1919
fetcher: async (request) => {
20-
if (request instanceof Request) {
21-
const requestWithHeaders = {
22-
...request,
23-
headers: {
24-
...request.headers,
25-
...headers,
26-
},
27-
};
28-
return fetch(requestWithHeaders);
20+
if (request instanceof Request && headers) {
21+
headers.forEach((headerValue, headerName) => {
22+
if (headerValue) {
23+
request.headers.set(headerName, headerValue);
24+
}
25+
});
2926
}
27+
3028
return fetch(request);
3129
},
3230
});

0 commit comments

Comments
 (0)