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.

@momack2 momack2 added this to Ready in ipfs/js-ipfs May 10, 2019
@momack2 momack2 added this to Ready in ipfs/js-waffle May 10, 2019
@alanshaw alanshaw mentioned this issue Jul 29, 2019
1 task
alanshaw added 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 <alan.shaw@protocol.ai>
@hsanjuan hsanjuan removed this from Ready in ipfs/js-ipfs Apr 27, 2020
@hsanjuan hsanjuan removed this from Ready in ipfs/js-waffle Apr 27, 2020
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