@@ -256,11 +256,13 @@ export default class Client extends API {
256
256
}
257
257
}
258
258
259
- const headers : Record < string , any > = {
259
+ const headers : Record < string , any > = Object . assign ( { } , {
260
260
'user-agent' : `elasticsearch-js/${ clientVersion } (${ os . platform ( ) } ${ os . release ( ) } -${ os . arch ( ) } ; Node.js ${ nodeVersion } ; Transport ${ transportVersion } )`
261
- }
261
+ } , opts . headers ?? { } )
262
262
if ( opts . serverMode === 'serverless' ) headers [ 'elastic-api-version' ] = serverlessApiVersion
263
263
264
+ const redaction = Object . assign ( { } , { type : 'replace' , additionalKeys : [ ] } , opts . redaction ?? { } )
265
+
264
266
const options : Required < ClientOptions > = Object . assign ( { } , {
265
267
Connection : UndiciConnection ,
266
268
Transport : opts . serverMode === 'serverless' ? Transport : SniffingTransport ,
@@ -277,7 +279,6 @@ export default class Client extends API {
277
279
tls : null ,
278
280
caFingerprint : null ,
279
281
agent : null ,
280
- headers,
281
282
nodeFilter : null ,
282
283
generateRequestId : null ,
283
284
name : 'elasticsearch-js' ,
@@ -288,12 +289,8 @@ export default class Client extends API {
288
289
enableMetaHeader : true ,
289
290
maxResponseSize : null ,
290
291
maxCompressedResponseSize : null ,
291
- redaction : {
292
- type : 'replace' ,
293
- additionalKeys : [ ]
294
- } ,
295
292
serverMode : 'stack'
296
- } , opts )
293
+ } , opts , { headers , redaction } )
297
294
298
295
if ( options . caFingerprint != null && isHttpConnection ( opts . node ?? opts . nodes ) ) {
299
296
throw new errors . ConfigurationError ( 'You can\'t configure the caFingerprint with a http connection' )
0 commit comments