From 4236cef5bfa18ec441ebc20a3221ef36e33cc39f Mon Sep 17 00:00:00 2001 From: Miki Date: Tue, 21 Mar 2023 11:20:27 -0700 Subject: [PATCH] Omit adding the `osd-version` header when the Fetch request was explicitly asked to not prepend the `basePath` Fixes #3277 Signed-off-by: Miki --- src/core/public/http/fetch.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/public/http/fetch.ts b/src/core/public/http/fetch.ts index cefaa353f7fa..d97512e75038 100644 --- a/src/core/public/http/fetch.ts +++ b/src/core/public/http/fetch.ts @@ -144,7 +144,6 @@ export class Fetch { headers: removedUndefined({ 'Content-Type': 'application/json', ...options.headers, - 'osd-version': this.params.opensearchDashboardsVersion, }), }; @@ -158,6 +157,12 @@ export class Fetch { fetchOptions.headers['osd-system-request'] = 'true'; } + // If base-path was explicitly asked to not be prepended, this must be an external call + // ToDo: Find out if the `osd-version` header serves any purpose + if (!shouldPrependBasePath) { + fetchOptions.headers['osd-version'] = this.params.opensearchDashboardsVersion; + } + return new Request(url, fetchOptions as RequestInit); }