Skip to content

Commit

Permalink
Ensure headers from middleare are passed into NativeFetcher (#1177)
Browse files Browse the repository at this point in the history
* Ensure headers from middleare are passed into NativeFetcher

* remove headers field on NativeFetcherOptions to avoid duplicates
  • Loading branch information
art-alexeyenko authored Sep 30, 2022
1 parent 41c19ef commit 1ba7b99
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,17 @@ export class PersonalizeMiddleware {
// NOTE: same here, we provide NativeDataFetcher for compatibility on Next.js Edge Runtime
this.cdpService = new CdpService({
...config.cdpConfig,
dataFetcherResolver: <T>({ timeout }: { timeout: number }) => {
dataFetcherResolver: <T>({
timeout,
headers,
}: {
timeout: number;
headers?: Record<string, string>;
}) => {
const fetcher = new NativeDataFetcher({
debugger: debug.personalize,
timeout,
headers,
});
return (url: string, data?: unknown) => fetcher.fetch<T>(url, data);
},
Expand Down

0 comments on commit 1ba7b99

Please sign in to comment.