Commit Graph

80 Commits

Author SHA1 Message Date
Timothy Gu 1d4ab5a0de Switch to .mjs for ES module output for Node.js compat
This also reverts commit 60cf26c2f3.
2018-07-22 14:06:25 -07:00
Timothy Gu c01a5d22d4 Move .default assignment to plugins 2018-07-22 14:06:25 -07:00
Timothy Gu aed2e69a39
Make sure to finalize the request properly (#432)
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
2018-03-24 20:50:33 -07:00
Timothy Gu 8aac53679d
Fix custom Host header with arbitrary case (#430)
Regression since 1592ca1148.

Fixes: #416
Fixes: #425
2018-03-22 22:01:45 -07:00
Timothy Gu 780598ad72
Harmonize style (#413) 2018-03-04 20:29:12 -08:00
Timothy Gu 119138ef64 Update existing algorithm step numbers 2018-03-04 20:25:16 -08:00
Timothy Gu 35722f19e5 Significant rework of redirection
- 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]>
2018-03-04 20:25:16 -08:00
Timothy Gu feae6d6ec8
Ignore illegal HTTP headers
Fixes: #411
2018-03-04 13:12:36 -08:00
Timothy Gu b1cd2dd438
Better compliance with Web IDL
- 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]>
2018-02-03 12:12:14 -08:00
Timothy Gu cf5975cb5c Support TypeScript import (#332)
Fixes #307.
2017-09-24 13:06:41 +08:00
Timothy Gu 60cf26c2f3
Use require() for Node.js core modules
Fixes: #318
2017-07-27 00:15:32 +08:00
David Frank 770388db1b only enable Z_SYNC_FLUSH for gzip response 2017-05-15 19:45:04 +08:00
Kat Marchán e5ff203ef4 Revert "Allow passing agent option as an object (#236)" (#263)
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.
2017-04-08 18:33:46 -07:00
Ahmad Nassri ec29e3d264 Allow passing agent option as an object (#236) 2017-04-03 02:54:31 -07:00
Grzegorz Graczyk a1e76b97e1 More lenient gzip decompression (#239)
Ref: https://github.com/nodejs/node/issues/8701#issuecomment-268224481
Ref: https://github.com/request/request/issues/2482
Ref: https://github.com/request/request/pull/2492
Fixes: http://www.mantovanispa.it
Fixes: #139
2017-02-27 10:02:45 -08:00
Timothy Gu 397eab7757 compress: use spec nomenclature 2017-02-26 21:27:27 -08:00
Timothy Gu 25e43a8f3e Export FetchError and update ERROR-HANDLING.md 2017-02-26 16:46:34 -08:00
Timothy Gu 55e573b741 Back to 100% coverage 2017-02-26 15:30:43 -08:00
Timothy Gu 11a9481405 request: overwrite Content-Length if possible
Also reorganize header normalization
2017-01-29 10:06:54 -08:00
Timothy Gu e9db869523 Remove FOLLOW_SPEC option; make it the default behavior (#225)
* Remove !FOLLOW_SPEC mode

* Update UPGRADE-GUIDE

* Add CHANGELOG entry
2017-01-23 07:54:28 -08:00
Timothy Gu 151de2bdfb Use ES2015 export syntax (#212)
* Implement Rollup's external module check

* Use ES2015 export syntax

More friendly to ES2015 environments.
2017-01-14 20:50:10 -08:00
Timothy Gu a604069860 More exact content-type and content-length
Set content-type of requests with body being objects to text/plain
2016-12-05 20:27:08 -08:00
Timothy Gu cc4ace1778 Make body default to null in Request
Fixes #208.
2016-12-04 13:16:03 -08:00
Timothy Gu 70f61e0c7d Split http.request options generation 2016-11-26 15:10:23 -08:00
Timothy Gu 0285828fb8 Split Content-Type extraction to Request and Body
It is done in this way in the spec.
2016-11-26 15:10:23 -08:00
Timothy Gu 2a7ef63bc4 Add FOLLOW_SPEC mode 2016-10-15 08:21:51 -07:00
Timothy Gu ba226399d4 Construct Headers object in a spec-compliant fashion 2016-10-15 08:21:51 -07:00
Timothy Gu 838071247d Convert all files to ES2015 (#182)
Elements of this commit come from #140 by @gwicke.
2016-10-10 11:50:04 -07:00
Timothy Gu 993d4cdea1 Convert Headers to ES2015 and implement Iterable interface (#180)
Closes #127, #174.
2016-10-08 20:51:01 -07:00
Timothy Gu 7c26fa9479 Add Babel infrastructure
No actual code has been changed yet.
2016-10-04 02:59:46 -07:00