Unfortunately, I could not write a test case that allows testing the bug
in #428. Credits to Roman Zaharenkov <[email protected]> for
discovering this long-standing bug and proposing a first version of the
fix.
Co-authored-by: Roman Zaharenkov <[email protected]>
Fixes: #428
- Handle Location-less redirect like non-redirect response.
- Include bodies when redirecting to non-POST 301/302 and all 307/308
response.
Co-authored-by: Gregor Martynus <[email protected]>
- Make read-only attributes actually read-only
- Set @@toStringTag on the prototype only
- Make prototype methods/getters enumerable
Based on #354.
Co-authored-by: Benjamin Seber <[email protected]>
This reverts commit ec29e3d264.
This patch prevents any agent being passed in which is not explicitly
an instance of `http.Agent`. This makes `node-fetch` no longer
compatible with https://npm.im/proxy-agent, which is one example of a
library that does not directly inherit from `http.Agent` directly.
Sorry for the revert -- I don't have an alternative patch because I
don't believe this is something node-fetch should be doing
automatically, because of how much of a limitation this could impose.
The original PR stated that this was to prevent requiring http/https,
and the effect would effectively be to force creation of an Agent on
every call. Note that this is already the behavior specified for
http.Agent when http.request received `false`. (See the bottom of the
[section on http.Agent in the Node
docs](https://nodejs.org/dist/latest-v7.x/docs/api/http.html#http_class_http_agent).
Cheers, and with apologies to @ahmadnassri for reverting their PR.