diff options
Diffstat (limited to 'doc/api/http.md')
-rw-r--r-- | doc/api/http.md | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/doc/api/http.md b/doc/api/http.md index dab18b5539..cbedf8c99b 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -661,7 +661,7 @@ added: v0.5.9 * `timeout` {number} Milliseconds before a request times out. * `callback` {Function} Optional function to be called when a timeout occurs. - Same as binding to the `timeout` event. + Same as binding to the `'timeout'` event. * Returns: {http.ClientRequest} Once a socket is assigned to this request and is connected @@ -774,12 +774,12 @@ changes: pr-url: https://github.com/nodejs/node/pull/4557 description: The default action of calling `.destroy()` on the `socket` will no longer take place if there are listeners attached - for `clientError`. + for `'clientError'`. - version: v9.4.0 pr-url: https://github.com/nodejs/node/pull/17672 description: The rawPacket is the current buffer that just parsed. Adding - this buffer to the error object of clientError event is to make - it possible that developers can log the broken packet. + this buffer to the error object of `'clientError'` event is to + make it possible that developers can log the broken packet. --> * `exception` {Error} @@ -1929,7 +1929,7 @@ There are a few special headers that should be noted. * Sending an 'Expect' header will immediately send the request headers. Usually, when sending 'Expect: 100-continue', both a timeout and a listener - for the `continue` event should be set. See RFC2616 Section 8.2.3 for more + for the `'continue'` event should be set. See RFC2616 Section 8.2.3 for more information. * Sending an Authorization header will override using the `auth` option @@ -1948,45 +1948,45 @@ const req = http.request(options, (res) => { In a successful request, the following events will be emitted in the following order: -* `socket` -* `response` - * `data` any number of times, on the `res` object - (`data` will not be emitted at all if the response body is empty, for +* `'socket'` +* `'response'` + * `'data'` any number of times, on the `res` object + (`'data'` will not be emitted at all if the response body is empty, for instance, in most redirects) - * `end` on the `res` object -* `close` + * `'end'` on the `res` object +* `'close'` In the case of a connection error, the following events will be emitted: -* `socket` -* `error` -* `close` +* `'socket'` +* `'error'` +* `'close'` If `req.abort()` is called before the connection succeeds, the following events will be emitted in the following order: -* `socket` +* `'socket'` * (`req.abort()` called here) -* `abort` -* `close` -* `error` with an error with message `Error: socket hang up` and code - `ECONNRESET` +* `'abort'` +* `'close'` +* `'error'` with an error with message `'Error: socket hang up'` and code + `'ECONNRESET'` If `req.abort()` is called after the response is received, the following events will be emitted in the following order: -* `socket` -* `response` - * `data` any number of times, on the `res` object +* `'socket'` +* `'response'` + * `'data'` any number of times, on the `res` object * (`req.abort()` called here) -* `abort` -* `close` - * `aborted` on the `res` object - * `end` on the `res` object - * `close` on the `res` object - -Note that setting the `timeout` option or using the `setTimeout` function will -not abort the request or do anything besides add a `timeout` event. +* `'abort'` +* `'close'` + * `'aborted'` on the `res` object + * `'end'` on the `res` object + * `'close'` on the `res` object + +Note that setting the `timeout` option or using the `setTimeout()` function will +not abort the request or do anything besides add a `'timeout'` event. [`'checkContinue'`]: #http_event_checkcontinue [`'request'`]: #http_event_request |