Skip to content
Browse files

refactor: rewrite the net module to simplify state tracking (#21244)

  • Loading branch information
nornagon committed Nov 27, 2019
1 parent 4149d76 commit d25256dcf56616cfb1699dd38c6e6c47d39bb858
@@ -32,8 +32,8 @@ the hostname and the port number 'hostname:port'.
* `redirect` String (optional) - The redirect mode for this request. Should be
one of `follow`, `error` or `manual`. Defaults to `follow`. When mode is `error`,
any redirection will be aborted. When mode is `manual` the redirection will be
deferred until [`request.followRedirect`](#requestfollowredirect) is invoked. Listen for the [`redirect`](#event-redirect) event in
this mode to get more details about the redirect request.
cancelled unless [`request.followRedirect`](#requestfollowredirect) is invoked
synchronously during the [`redirect`](#event-redirect) event.

`options` properties such as `protocol`, `host`, `hostname`, `port` and `path`
strictly follow the Node.js model as described in the
@@ -136,8 +136,11 @@ Returns:
* `redirectUrl` String
* `responseHeaders` Record<String, String[]>

Emitted when there is redirection and the mode is `manual`. Calling
[`request.followRedirect`](#requestfollowredirect) will continue with the redirection.
Emitted when the server returns a redirect response (e.g. 301 Moved
Permanently). Calling [`request.followRedirect`](#requestfollowredirect) will
continue with the redirection. If this event is handled,
[`request.followRedirect`](#requestfollowredirect) must be called
**synchronously**, otherwise the request will be cancelled.

### Instance Properties

@@ -214,7 +217,8 @@ response object,it will emit the `aborted` event.

#### `request.followRedirect()`

Continues any deferred redirection request when the redirection mode is `manual`.
Continues any pending redirection. Can only be called during a `'redirect'`

#### `request.getUploadProgress()`

@@ -98,8 +98,8 @@ filenames = {

0 comments on commit d25256d

Please sign in to comment.
You can’t perform that action at this time.