Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkuhrt committed Jan 23, 2025
1 parent 863ae8c commit edb63e8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/graphiql-toolkit/src/create-fetcher/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,14 @@ export async function getWsFetcher(
return createWebsocketsFetcherFromClient(options.wsClient);
}
if (options.subscriptionUrl) {
// todo: If there are headers with multiple values, they will be lost. Is this a problem?
const fetcherOptsHeadersRecord = Object.fromEntries(
// @ts-expect-error: todo enable ES target that has entries on headers
new Headers(fetcherOpts?.headers ?? {}).entries(),
);
// @ts-expect-error: todo enable ES target that has entries on headers
const fetcherOptsHeaders = new Headers(
fetcherOpts?.headers ?? {},
).entries();

return createWebsocketsFetcherFromUrl(options.subscriptionUrl, {
...options.wsConnectionParams,
...fetcherOptsHeadersRecord,
...Object.fromEntries(fetcherOptsHeaders),
});
}
const legacyWebsocketsClient = options.legacyClient || options.legacyWsClient;
Expand Down

0 comments on commit edb63e8

Please sign in to comment.