diff --git a/src/core/server/elasticsearch/client/mocks.ts b/src/core/server/elasticsearch/client/mocks.ts index dc5dfc0e6410b..26a68df81f24e 100644 --- a/src/core/server/elasticsearch/client/mocks.ts +++ b/src/core/server/elasticsearch/client/mocks.ts @@ -11,6 +11,7 @@ import { TransportRequestPromise } from '@elastic/elasticsearch/lib/Transport'; import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; import { ElasticsearchClient } from './types'; import { ICustomClusterClient } from './cluster_client'; +import { PRODUCT_RESPONSE_HEADER } from '../supported_server_response_check'; const createInternalClientMock = ( res?: MockedTransportRequestPromise @@ -142,7 +143,7 @@ export type MockedTransportRequestPromise = TransportRequestPromise & { const createSuccessTransportRequestPromise = ( body: T, { statusCode = 200 }: { statusCode?: number } = {}, - headers: Record = { 'x-elastic-product': 'Elasticsearch' } + headers: Record = { [PRODUCT_RESPONSE_HEADER]: 'Elasticsearch' } ): MockedTransportRequestPromise> => { const response = createApiResponse({ body, statusCode, headers }); const promise = Promise.resolve(response); @@ -163,7 +164,7 @@ function createApiResponse>( return { body: {} as any, statusCode: 200, - headers: { 'x-elastic-product': 'Elasticsearch' }, + headers: { [PRODUCT_RESPONSE_HEADER]: 'Elasticsearch' }, warnings: [], meta: {} as any, ...opts, diff --git a/src/core/server/elasticsearch/index.ts b/src/core/server/elasticsearch/index.ts index 84a973eada8e5..f50e3a0f72860 100644 --- a/src/core/server/elasticsearch/index.ts +++ b/src/core/server/elasticsearch/index.ts @@ -41,4 +41,5 @@ export { getRequestDebugMeta, getErrorMessage } from './client'; export { isSupportedEsServer, isNotFoundFromUnsupportedServer, + PRODUCT_RESPONSE_HEADER, } from './supported_server_response_check';