* fix: premature close with chunked transfer encoding and for async iterators in Node 12
This PR backports the fix from #1064 to the `2.x.x` branch following
the [comment here](https://github.com/node-fetch/node-fetch/pull/1064#issuecomment-849167400).
I had to add some extra babel config to allow using the `for await..of`
syntax in the tests. The config is only needed for the tests as
this syntax is not used in the implementation.
* chore: fix up tests for node 6+
* chore: codecov dropped support for node < 8 without shipping major
* chore: npm7 strips empty dependencies hash during install
* chore: pin deps to versions that work on node 4
* chore: do not emit close error after aborting a request
* chore: test on node 4-16
* chore: simplify chunked transer encoding bad ending
* chore: avoid calling .destroy as it is not in every node.js release
* chore: listen for response close as socket is reused and shows warnings
* Update readme and changelog for `options.agent`
- Fix content-length issue introduced in v2.5.0
* More test coverage for `extractContentType`
* Slightly improve test performance
* `Response.url` should not return null
* Document `Headers.raw()` usage better
* 2.6.0
* dev package bump
* test invalid header differently as node 12 no longer accepts invalid headers in response
* add node v10 in travis test list as node 12 has been released
* fix import rule for stream PassThrough
* avoid named export for compatibility below node 10
* compress flag should not overwrite accept encoding header
* doc update
* 2.2.1
- 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 <gregor@martynus.net>
- 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 <seber@synyx.de>
* remove `encoding` as a dependency, throw descriptive Error if textConverted() is used without it in env
* remove rollup ext dep resolution since we don't need it
* switch to programmer error, rm unneeded test conditions, bump timeout for slow CI
* more kill `encoding` dep PR changes
keep blank "dependencies" prop in package.json so rollup's external config func doesn't seize
add ext dep checks back to the rollup config
no implicit var
clarify test comment
* [squash] alter travis cfg to test with and without `encoding`, various
fix devDeps
separate `encoding` tests to their own block
* [squash] fixing nits
* [squash] ci: full matrix of form-data versions and encoding existence
and nits