From 046d9b81918043be83c6e96ab5272fc3bed7b89e 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 13:15:47 +0200 Subject: [PATCH] fix(editor): Set `browser-id` on all relative urls (no-changelog) --- packages/editor-ui/src/utils/apiUtils.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/editor-ui/src/utils/apiUtils.ts b/packages/editor-ui/src/utils/apiUtils.ts index c82219ba0e906..b0f43dce5010a 100644 --- a/packages/editor-ui/src/utils/apiUtils.ts +++ b/packages/editor-ui/src/utils/apiUtils.ts @@ -78,8 +78,11 @@ export async function request(config: { method, url: endpoint, baseURL, - headers, + headers: headers ?? {}, }; + if (baseURL.startsWith('/') && browserId) { + options.headers!['browser-id'] = browserId; + } if ( import.meta.env.NODE_ENV !== 'production' && !baseURL.includes('api.n8n.io') && @@ -128,15 +131,11 @@ 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, + headers: { 'push-ref': context.pushRef }, data, });