From 30880fa3615a1c3790568d0f95606298b36f63e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Tue, 9 Apr 2024 00:23:01 +0200 Subject: [PATCH] set browser-id header only on api requests, and not on external requests --- packages/editor-ui/src/utils/apiUtils.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/editor-ui/src/utils/apiUtils.ts b/packages/editor-ui/src/utils/apiUtils.ts index a1bcf022c61eb..c82219ba0e906 100644 --- a/packages/editor-ui/src/utils/apiUtils.ts +++ b/packages/editor-ui/src/utils/apiUtils.ts @@ -78,11 +78,8 @@ export async function request(config: { method, url: endpoint, baseURL, - headers: headers ?? {}, + headers, }; - if (browserId) { - options.headers!['browser-id'] = browserId; - } if ( import.meta.env.NODE_ENV !== 'production' && !baseURL.includes('api.n8n.io') && @@ -131,11 +128,15 @@ export async function makeRestApiRequest( endpoint: string, data?: IDataObject | IDataObject[], ) { + const headers: RawAxiosRequestHeaders = { 'push-ref': context.pushRef }; + if (browserId) { + headers['browser-id'] = browserId; + } const response = await request({ method, baseURL: context.baseUrl, endpoint, - headers: { 'push-ref': context.pushRef }, + headers, data, });