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

fix: do not double normalise input url #3351

Merged
merged 1 commit into from
Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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