-
The Is it possible to create a new Background is that we are upgrading @octokit to use the native fetch method by default. We currently support an Alternatively we could ask users to use undici.setGlobalDispatcher(dispatcher), but I wonder if that will break some use cases, hence the question. Related question: Is the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
I don't understand the question, what kind of API are you looking for? function myFetch (url, opts) {
opts ||= {}
opts.dispatcher = new MyAgent()
return fetch(url, opts)
} Or are you looking for some kind of other utilities?
I like this approach a lot.
Calling Note that the implementation is trivial and it relies on a global symbol, so we could easily add it to core: https://github.com/nodejs/undici/blob/main/lib/global.js. |
Beta Was this translation helpful? Give feedback.
I don't understand the question, what kind of API are you looking for?
fetch()
is just a function, so no one stops you from doing:Or are you looking for some kind of other utilities?