diff --git a/package.json b/package.json index 564ea2ec..ad443893 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dropbox", - "version": "10.15.0", + "version": "10.16.0", "registry": "npm", "description": "The Dropbox JavaScript SDK is a lightweight, promise based interface to the Dropbox v2 API that works in both nodejs and browser environments.", "main": "cjs/index.js", diff --git a/src/utils.js b/src/utils.js index e94690a6..3d93de23 100644 --- a/src/utils.js +++ b/src/utils.js @@ -6,6 +6,9 @@ function getSafeUnicode(c) { } export const baseApiUrl = (subdomain, domain = DEFAULT_API_DOMAIN, domainDelimiter = '.') => { + if (!domainDelimiter) { + return `https://${domain}/2/`; + } if (domain !== DEFAULT_API_DOMAIN && TEST_DOMAIN_MAPPINGS[subdomain] !== undefined) { subdomain = TEST_DOMAIN_MAPPINGS[subdomain]; domainDelimiter = '-'; diff --git a/test/unit/utils.js b/test/unit/utils.js index 091d0934..e136a456 100644 --- a/test/unit/utils.js +++ b/test/unit/utils.js @@ -10,6 +10,13 @@ import { describe('Dropbox utils', () => { describe('baseApiUrl', () => { + it('correctly sets base url when domainDelimiter is empty', () => { + const host = 'api'; + const domain = 'mydomain.com'; + const testUrl = baseApiUrl(host, domain, ''); + chai.assert.equal(testUrl, 'https://mydomain.com/2/'); + }); + it('correctly sets base url when provided a subdomain', () => { const host = 'test'; const testUrl = baseApiUrl(host);