Add api compatibility header support (#1478) (#1491)

Co-authored-by: Tomas Della Vedova <delvedor@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2021-07-13 09:48:30 +02:00
committed by GitHub
parent ea2c8d2d4d
commit 28d8ff799e
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