Commit Graph

23 Commits

Author SHA1 Message Date
Timothy Gu 119138ef64 Update existing algorithm step numbers 2018-03-04 20:25:16 -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 8c7c179fef
Add some more internal API docs 2018-02-03 11:19:32 -08:00
David Frank 3345b652e4
fix a small oversight in request class
lowercase method name does not trigger type error properly (#362)
2017-11-19 12:44:02 +08:00
Timothy Gu 60cf26c2f3
Use require() for Node.js core modules
Fixes: #318
2017-07-27 00:15:32 +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
Timothy Gu 55e573b741 Back to 100% coverage 2017-02-26 15:30:43 -08:00
Timothy Gu 9e140039ac Factor out Body mixin 2017-02-26 14:42:09 -08:00
Timothy Gu f08b120771 Do not inherit from body
Per spec, make Body a proper mixin
2017-02-26 14:29:40 -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 7970491000 Use template literals in Request
Closes #217.
2016-12-14 15:45:00 -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 3d676235a8 Throw when a GET/HEAD Request is created with body
As mandated by the spec
2016-12-04 13:15: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 4ae42ea5ee Fix class names for prototypes
Per Web IDL specification.
2016-11-23 14:36:21 -08:00
Timothy Gu 76cb57cace Support WHATWG URL objects
Fixes #175.
2016-10-15 10:19:52 -07:00
Timothy Gu a0be6aa34a Simplify Request constructor
Also make Request more standard compliant:

> The `url` attribute's getter must return request's url, **serialized.**
2016-10-12 17:29:33 -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