@@ -256,11 +256,13 @@ export default class Client extends API {
256256 }
257257 }
258258
259- const headers : Record < string , any > = {
259+ const headers : Record < string , any > = Object . assign ( { } , {
260260 'user-agent' : `elasticsearch-js/${ clientVersion } (${ os . platform ( ) } ${ os . release ( ) } -${ os . arch ( ) } ; Node.js ${ nodeVersion } ; Transport ${ transportVersion } )`
261- }
261+ } , opts . headers ?? { } )
262262 if ( opts . serverMode === 'serverless' ) headers [ 'elastic-api-version' ] = serverlessApiVersion
263263
264+ const redaction = Object . assign ( { } , { type : 'replace' , additionalKeys : [ ] } , opts . redaction ?? { } )
265+
264266 const options : Required < ClientOptions > = Object . assign ( { } , {
265267 Connection : UndiciConnection ,
266268 Transport : opts . serverMode === 'serverless' ? Transport : SniffingTransport ,
@@ -277,7 +279,6 @@ export default class Client extends API {
277279 tls : null ,
278280 caFingerprint : null ,
279281 agent : null ,
280- headers,
281282 nodeFilter : null ,
282283 generateRequestId : null ,
283284 name : 'elasticsearch-js' ,
@@ -288,12 +289,8 @@ export default class Client extends API {
288289 enableMetaHeader : true ,
289290 maxResponseSize : null ,
290291 maxCompressedResponseSize : null ,
291- redaction : {
292- type : 'replace' ,
293- additionalKeys : [ ]
294- } ,
295292 serverMode : 'stack'
296- } , opts )
293+ } , opts , { headers , redaction } )
297294
298295 if ( options . caFingerprint != null && isHttpConnection ( opts . node ?? opts . nodes ) ) {
299296 throw new errors . ConfigurationError ( 'You can\'t configure the caFingerprint with a http connection' )
0 commit comments