Add api compatibility header support (#1478)

This commit is contained in:
Tomas Della Vedova
2021-07-13 09:47:45 +02:00
committed by GitHub
parent 101a13f63e
commit 4073d60b97
4 changed files with 75 additions and 4 deletions

View File

@ -116,6 +116,10 @@ class Client extends ESAPI {
disablePrototypePoisoningProtection: false
}, opts)
if (process.env.ELASTIC_CLIENT_APIVERSIONING === 'true') {
options.headers = Object.assign({ accept: 'application/vnd.elasticsearch+json; compatible-with=7' }, options.headers)
}
this[kInitialOptions] = options
this[kExtensions] = []
this.name = options.name