From a7076a9f37679065e3cae582cbf071e771df6abf Mon Sep 17 00:00:00 2001 From: Juri Leino Date: Wed, 18 Oct 2023 12:18:52 +0200 Subject: [PATCH] fix(connection): readOptionsFromEnv sets protocol This is needed to allow REST connections using `http:` to override the default (`https:`). --- components/connection.js | 1 + spec/tests/readenv.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/components/connection.js b/components/connection.js index c390520..e1aabda 100644 --- a/components/connection.js +++ b/components/connection.js @@ -147,6 +147,7 @@ function readOptionsFromEnv () { environmentOptions.secure = protocol === 'https:' environmentOptions.host = hostname environmentOptions.port = port + environmentOptions.protocol = protocol } return environmentOptions diff --git a/spec/tests/readenv.js b/spec/tests/readenv.js index 7c818ec..c2e0ef6 100644 --- a/spec/tests/readenv.js +++ b/spec/tests/readenv.js @@ -12,10 +12,12 @@ test('connection options from environment', function (t) { t.equal(optionsFromEnv.port, port) t.equal(optionsFromEnv.secure, protocol === 'https:') t.equal(optionsFromEnv.host, hostname) + t.equal(optionsFromEnv.protocol, protocol) } else { t.false('port' in optionsFromEnv) t.false('secure' in optionsFromEnv) t.false('host' in optionsFromEnv) + t.false('protocol' in optionsFromEnv) } if (userIsSet) {