@@ -24,6 +24,7 @@ import { GetAuthHeaders } from '../../http';
2424import { elasticsearchClientMock } from './mocks' ;
2525import { ClusterClient } from './cluster_client' ;
2626import { ElasticsearchClientConfig } from './client_config' ;
27+ import { KIBANA_HEADERS } from '../kibana_headers' ;
2728
2829const createConfig = (
2930 parts : Partial < ElasticsearchClientConfig > = { }
@@ -127,7 +128,7 @@ describe('ClusterClient', () => {
127128
128129 expect ( scopedClient . child ) . toHaveBeenCalledTimes ( 1 ) ;
129130 expect ( scopedClient . child ) . toHaveBeenCalledWith ( {
130- headers : { foo : 'bar' , 'x-opaque-id' : expect . any ( String ) } ,
131+ headers : { ... KIBANA_HEADERS , foo : 'bar' , 'x-opaque-id' : expect . any ( String ) } ,
131132 } ) ;
132133 } ) ;
133134
@@ -147,7 +148,7 @@ describe('ClusterClient', () => {
147148
148149 expect ( scopedClient . child ) . toHaveBeenCalledTimes ( 1 ) ;
149150 expect ( scopedClient . child ) . toHaveBeenCalledWith ( {
150- headers : { authorization : 'auth' , 'x-opaque-id' : expect . any ( String ) } ,
151+ headers : { ... KIBANA_HEADERS , authorization : 'auth' , 'x-opaque-id' : expect . any ( String ) } ,
151152 } ) ;
152153 } ) ;
153154
@@ -171,7 +172,7 @@ describe('ClusterClient', () => {
171172
172173 expect ( scopedClient . child ) . toHaveBeenCalledTimes ( 1 ) ;
173174 expect ( scopedClient . child ) . toHaveBeenCalledWith ( {
174- headers : { authorization : 'auth' , 'x-opaque-id' : expect . any ( String ) } ,
175+ headers : { ... KIBANA_HEADERS , authorization : 'auth' , 'x-opaque-id' : expect . any ( String ) } ,
175176 } ) ;
176177 } ) ;
177178
@@ -193,6 +194,7 @@ describe('ClusterClient', () => {
193194 expect ( scopedClient . child ) . toHaveBeenCalledTimes ( 1 ) ;
194195 expect ( scopedClient . child ) . toHaveBeenCalledWith ( {
195196 headers : {
197+ ...KIBANA_HEADERS ,
196198 foo : 'bar' ,
197199 hello : 'dolly' ,
198200 'x-opaque-id' : expect . any ( String ) ,
@@ -214,6 +216,7 @@ describe('ClusterClient', () => {
214216 expect ( scopedClient . child ) . toHaveBeenCalledTimes ( 1 ) ;
215217 expect ( scopedClient . child ) . toHaveBeenCalledWith ( {
216218 headers : {
219+ ...KIBANA_HEADERS ,
217220 'x-opaque-id' : 'my-fake-id' ,
218221 } ,
219222 } ) ;
@@ -239,6 +242,7 @@ describe('ClusterClient', () => {
239242 expect ( scopedClient . child ) . toHaveBeenCalledTimes ( 1 ) ;
240243 expect ( scopedClient . child ) . toHaveBeenCalledWith ( {
241244 headers : {
245+ ...KIBANA_HEADERS ,
242246 foo : 'auth' ,
243247 hello : 'dolly' ,
244248 'x-opaque-id' : expect . any ( String ) ,
@@ -266,6 +270,7 @@ describe('ClusterClient', () => {
266270 expect ( scopedClient . child ) . toHaveBeenCalledTimes ( 1 ) ;
267271 expect ( scopedClient . child ) . toHaveBeenCalledWith ( {
268272 headers : {
273+ ...KIBANA_HEADERS ,
269274 foo : 'request' ,
270275 hello : 'dolly' ,
271276 'x-opaque-id' : expect . any ( String ) ,
@@ -292,6 +297,7 @@ describe('ClusterClient', () => {
292297 expect ( scopedClient . child ) . toHaveBeenCalledTimes ( 1 ) ;
293298 expect ( scopedClient . child ) . toHaveBeenCalledWith ( {
294299 headers : {
300+ ...KIBANA_HEADERS ,
295301 'x-opaque-id' : 'from request' ,
296302 } ,
297303 } ) ;
@@ -315,7 +321,7 @@ describe('ClusterClient', () => {
315321
316322 expect ( scopedClient . child ) . toHaveBeenCalledTimes ( 1 ) ;
317323 expect ( scopedClient . child ) . toHaveBeenCalledWith ( {
318- headers : { authorization : 'auth' } ,
324+ headers : { ... KIBANA_HEADERS , authorization : 'auth' } ,
319325 } ) ;
320326 } ) ;
321327
@@ -339,7 +345,7 @@ describe('ClusterClient', () => {
339345
340346 expect ( scopedClient . child ) . toHaveBeenCalledTimes ( 1 ) ;
341347 expect ( scopedClient . child ) . toHaveBeenCalledWith ( {
342- headers : { foo : 'bar' } ,
348+ headers : { ... KIBANA_HEADERS , foo : 'bar' } ,
343349 } ) ;
344350 } ) ;
345351 } ) ;
0 commit comments