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) } 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')