Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Allow providing function used to perform fetch #932

Closed
Gozala opened this issue Jan 24, 2019 · 0 comments · Fixed by #1059
Closed

Allow providing function used to perform fetch #932

Gozala opened this issue Jan 24, 2019 · 0 comments · Fixed by #1059

Comments

@Gozala
Copy link

Gozala commented Jan 24, 2019

From what I can tell right now implementation chooses between http / https modules to do network request. In browser case however it would be very useful to allow passing custom fetch that would perform it in the origin that has permission to talk to daemon.

However it's not as simple as just adding config.fetch as implementation assumes node (polyfill) which complicates things.

@alanshaw alanshaw mentioned this issue Jul 29, 2019
1 task
alanshaw pushed a commit that referenced this issue Aug 28, 2019
This PR enabled pubsub in the browser and paves the way for a switch to using `fetch` by default and allowing for cancelable requests via the use of `AbortController`.

It's mostly the work done in ipfs-shipyard/js-ipfs-http-client-lite#1 but adapted a bit for use here.

If approved, we can start work moving the other commands to use `fetch`. The work in https://github.com/ipfs-shipyard/js-ipfs-http-client-lite has proven the hard parts (uploading files) are all possible using the `fetch` API.

Since `fetch` is promise based, when moving the other commands it makes sense to just switch to async/await as per ipfs/js-ipfs#1670 (and callbackify instead of promisify).

Depends on:

* [x] ipfs-inactive/interface-js-ipfs-core#505

resolves #518
refs ipfs/js-ipfs#2093
resolves #932

License: MIT
Signed-off-by: Alan Shaw <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants