Replies: 1 comment
-
I have been thinking of something similar. Like adding the FetchObserver for instance onto the Request internals import fetch, { attachObserver, Request } from 'node-fetch'
const req = new Request(url, { method: 'post', body: 'abc' })
attachObserver(req, {
observe(observer) {
observer.onresponseprogress = e => console.log(e);
observer.onrequestprogress = e => console.log(e);
observer.onstatechange = n => console.log(observer.state)
}
})
fetch(req) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is your feature request related to a problem? Please describe.
For fetch(), node-fetch mix whatwg-spec init and node-specifc properties togother. e.g.
Describe the solution you'd like
So my proposal is to provide a new method to configure fetch() client's defaults. e.g.
Describe alternatives you've considered
Or to define only one extended perperty in fetch() init. e.g.
Additional context
Note: the above function name
configureFetch
and property nameoptions
are just for presenting mechanisms.By the way: Arbitrary headers can be passed via the separate method, but considering code portion, they shouldn't be passed via fetch() init, since forbidden header name is defined in whatwg spec.
Beta Was this translation helpful? Give feedback.
All reactions