Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
fix: do not double normalise input url (#3351)
Browse files Browse the repository at this point in the history
No need to do this twice.

Fixes #3331
  • Loading branch information
achingbrain authored Oct 27, 2020
1 parent 33aa632 commit 4eb196c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/ipfs-http-client/src/lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 8 additions & 0 deletions packages/ipfs-http-client/test/constructor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 4eb196c

Please sign in to comment.