diff --git a/src/lib/core.js b/src/lib/core.js index 44f1774ba..a2f957a89 100644 --- a/src/lib/core.js +++ b/src/lib/core.js @@ -122,10 +122,11 @@ class Client extends HTTP { */ constructor (options = {}) { const opts = normalizeInput(options) + super({ timeout: parseTimeout(opts.timeout) || 60000 * 20, headers: opts.headers, - base: normalizeInput(opts.url).toString(), + base: `${opts.url}`, handleError: errorHandler, transformSearchParams: (search) => { const out = new URLSearchParams() diff --git a/test/constructor.spec.js b/test/constructor.spec.js index 7cca6332b..9b579839d 100644 --- a/test/constructor.spec.js +++ b/test/constructor.spec.js @@ -86,6 +86,14 @@ describe('ipfs-http-client constructor tests', () => { const ipfs = ipfsClient({ host, port, apiPath }) expectConfig(ipfs, { host, port, apiPath }) }) + + it('url', () => { + const host = '10.100.100.255' + const port = '9999' + const apiPath = '/future/api/v1/' + const ipfs = ipfsClient({ url: `http://${host}:${port}${apiPath}` }) + expectConfig(ipfs, { host, port, apiPath }) + }) }) describe('integration', () => {