From 659fe90ecedd6f321b130d8d992ec75a17b19559 Mon Sep 17 00:00:00 2001 From: VisualPlugin Date: Wed, 22 Nov 2023 01:56:47 +0000 Subject: [PATCH 1/2] feat: avoid needing api-key for defined host useful for local ors instances --- src/OrsBase.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/OrsBase.js b/src/OrsBase.js index b190f2b..36ee2a7 100644 --- a/src/OrsBase.js +++ b/src/OrsBase.js @@ -27,7 +27,8 @@ class OrsBase { } if (Constants.propNames.apiKey in args) { this.defaultArgs[Constants.propNames.apiKey] = args[Constants.propNames.apiKey] - } else { + } else if (!args[Constants.propNames.host]) { + // Do not error if a host is specified; useful for locally-run instances of ORS console.error(Constants.missingAPIKeyMsg) throw new Error(Constants.missingAPIKeyMsg) } From 7fdd364302b6b2ca1b3b66346be1d7f29d2a93d2 Mon Sep 17 00:00:00 2001 From: Amandus Butzer Date: Thu, 11 Jul 2024 15:49:01 +0200 Subject: [PATCH 2/2] test: verify OrsBase works for defined host without api_key --- src/__tests__/OrsBase.cy.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/__tests__/OrsBase.cy.js b/src/__tests__/OrsBase.cy.js index 6fc6cce..d165fcc 100644 --- a/src/__tests__/OrsBase.cy.js +++ b/src/__tests__/OrsBase.cy.js @@ -22,7 +22,6 @@ describe('Test Base class', () => { it('passes Host correctly', () => { const base = new OrsBase({ - 'api_key': 'test', 'host': 'localhost:8080' }) expect(base.defaultArgs, 'Base instance').to.haveOwnProperty('host')