Added global headers option

This commit is contained in:
delvedor
2019-02-20 12:43:06 +01:00
parent e9cc0324c2
commit 974bf0a819
2 changed files with 6 additions and 2 deletions

View File

@ -27,6 +27,7 @@ class Transport {
this.requestTimeout = toMs(opts.requestTimeout)
this.suggestCompression = opts.suggestCompression === true
this.compression = opts.compression || false
this.headers = opts.headers || {}
this.sniffInterval = opts.sniffInterval
this.sniffOnConnectionFault = opts.sniffOnConnectionFault
this.sniffEndpoint = opts.sniffEndpoint
@ -82,7 +83,8 @@ class Transport {
return callback(new NoLivingConnectionsError('There are not living connections'), result)
}
const headers = options.headers || {}
// TODO: make this assignment FAST
const headers = Object.assign({}, this.headers, options.headers)
// handle json body
if (params.body != null) {