feat: implement net.fetch (#36733)

This commit is contained in:
Jeremy Rose 2023-02-20 12:57:38 -08:00 committed by GitHub
parent 63f94f2359
commit 872d1fe05a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 969 additions and 539 deletions

View file

@ -23,12 +23,14 @@ following properties:
with which the request is associated. Defaults to the empty string. The
`session` option supersedes `partition`. Thus if a `session` is explicitly
specified, `partition` is ignored.
* `credentials` string (optional) - Can be `include` or `omit`. Whether to
send [credentials](https://fetch.spec.whatwg.org/#credentials) with this
* `credentials` string (optional) - Can be `include`, `omit` or
`same-origin`. Whether to send
[credentials](https://fetch.spec.whatwg.org/#credentials) with this
request. If set to `include`, credentials from the session associated with
the request will be used. If set to `omit`, credentials will not be sent
with the request (and the `'login'` event will not be triggered in the
event of a 401). This matches the behavior of the
event of a 401). If set to `same-origin`, `origin` must also be specified.
This matches the behavior of the
[fetch](https://fetch.spec.whatwg.org/#concept-request-credentials-mode)
option of the same name. If this option is not specified, authentication
data from the session will be sent, and cookies will not be sent (unless
@ -49,6 +51,13 @@ following properties:
[`request.followRedirect`](#requestfollowredirect) is invoked synchronously
during the [`redirect`](#event-redirect) event. Defaults to `follow`.
* `origin` string (optional) - The origin URL of the request.
* `referrerPolicy` string (optional) - can be `""`, `no-referrer`,
`no-referrer-when-downgrade`, `origin`, `origin-when-cross-origin`,
`unsafe-url`, `same-origin`, `strict-origin`, or
`strict-origin-when-cross-origin`. Defaults to
`strict-origin-when-cross-origin`.
* `cache` string (optional) - can be `default`, `no-store`, `reload`,
`no-cache`, `force-cache` or `only-if-cached`.
`options` properties such as `protocol`, `host`, `hostname`, `port` and `path`
strictly follow the Node.js model as described in the