Skip to content

Commit

Permalink
fix(editor): Set browser-id on all relative urls (no-changelog)
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy committed Apr 9, 2024
1 parent 4ac02dd commit 046d9b8
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/editor-ui/src/utils/apiUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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') &&
Expand Down Expand Up @@ -128,15 +131,11 @@ export async function makeRestApiRequest<T>(
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,
});

Expand Down

0 comments on commit 046d9b8

Please sign in to comment.