ApiKey should take precedence over basic auth (#1115)

* ApiKey should take precedence over basic auth

* Updated docs

* Updated test
This commit is contained in:
Tomas Della Vedova
2020-03-13 13:34:47 +01:00
committed by GitHub
parent 6bf04473c9
commit 9a9057db9e
4 changed files with 103 additions and 7 deletions

View File

@ -42,13 +42,13 @@ class BaseConnectionPool {
opts = this.urlToHost(opts)
}
if (opts.url.username !== '' && opts.url.password !== '') {
if (this.auth !== null) {
opts.auth = this.auth
} else if (opts.url.username !== '' && opts.url.password !== '') {
opts.auth = {
username: decodeURIComponent(opts.url.username),
password: decodeURIComponent(opts.url.password)
}
} else if (this.auth !== null) {
opts.auth = this.auth
}
if (opts.ssl == null) opts.ssl = this._ssl