@@ -568,6 +568,7 @@ server.listen(1337, '127.0.0.1', () => {
568568### ` request.abort() `
569569<!-- YAML
570570added: v0.3.8
571+ deprecated: REPLACEME
571572-->
572573
573574Marks the request as aborting. Calling this will cause remaining data
@@ -623,6 +624,31 @@ If `data` is specified, it is equivalent to calling
623624If ` callback ` is specified, it will be called when the request stream
624625is finished.
625626
627+ ### ` request.destroy([error]) `
628+ <!-- YAML
629+ added: v0.3.0
630+ -->
631+
632+ * ` error ` {Error} Optional, an error to emit with ` 'error' ` event.
633+ * Returns: {this}
634+
635+ Destroy the request. Optionally emit an ` 'error' ` event,
636+ and emit a ` 'close' ` event. Calling this will cause remaining data
637+ in the response to be dropped and the socket to be destroyed.
638+
639+ See [ ` writable.destroy() ` ] [ ] for further details.
640+
641+ #### ` request.destroyed `
642+ <!-- YAML
643+ added: REPLACEME
644+ -->
645+
646+ * {boolean}
647+
648+ Is ` true ` after [ ` request.destroy() ` ] [ ] has been called.
649+
650+ See [ ` writable.destroyed ` ] [ ] for further details.
651+
626652### ` request.finished `
627653<!-- YAML
628654added: v0.0.1
@@ -2354,8 +2380,43 @@ the following events will be emitted in the following order:
23542380* ` 'close' `
23552381* ` 'close' ` on the ` res ` object
23562382
2357- If ` req.abort() ` is called before the connection succeeds, the following events
2358- will be emitted in the following order:
2383+ If ` req.destroy() ` is called before a socket is assigned, the following
2384+ events will be emitted in the following order:
2385+
2386+ * (` req.destroy() ` called here)
2387+ * ` 'error' ` with an error with message ` 'Error: socket hang up' ` and code
2388+ ` 'ECONNRESET' `
2389+ * ` 'close' `
2390+
2391+ If ` req.destroy() ` is called before the connection succeeds, the following
2392+ events will be emitted in the following order:
2393+
2394+ * ` 'socket' `
2395+ * (` req.destroy() ` called here)
2396+ * ` 'error' ` with an error with message ` 'Error: socket hang up' ` and code
2397+ ` 'ECONNRESET' `
2398+ * ` 'close' `
2399+
2400+ If ` req.destroy() ` is called after the response is received, the following
2401+ events will be emitted in the following order:
2402+
2403+ * ` 'socket' `
2404+ * ` 'response' `
2405+ * ` 'data' ` any number of times, on the ` res ` object
2406+ * (` req.destroy() ` called here)
2407+ * ` 'aborted' ` on the ` res ` object
2408+ * ` 'close' `
2409+ * ` 'close' ` on the ` res ` object
2410+
2411+ If ` req.abort() ` is called before a socket is assigned, the following
2412+ events will be emitted in the following order:
2413+
2414+ * (` req.abort() ` called here)
2415+ * ` 'abort' `
2416+ * ` 'close' `
2417+
2418+ If ` req.abort() ` is called before the connection succeeds, the following
2419+ events will be emitted in the following order:
23592420
23602421* ` 'socket' `
23612422* (` req.abort() ` called here)
@@ -2364,8 +2425,8 @@ will be emitted in the following order:
23642425 ` 'ECONNRESET' `
23652426* ` 'close' `
23662427
2367- If ` req.abort() ` is called after the response is received, the following events
2368- will be emitted in the following order:
2428+ If ` req.abort() ` is called after the response is received, the following
2429+ events will be emitted in the following order:
23692430
23702431* ` 'socket' `
23712432* ` 'response' `
@@ -2411,6 +2472,7 @@ not abort the request or do anything besides add a `'timeout'` event.
24112472[ `new URL()` ] : url.html#url_constructor_new_url_input_base
24122473[ `removeHeader(name)` ] : #http_request_removeheader_name
24132474[ `request.end()` ] : #http_request_end_data_encoding_callback
2475+ [ `request.destroy()` ] : #http_request_destroy_error
24142476[ `request.flushHeaders()` ] : #http_request_flushheaders
24152477[ `request.getHeader()` ] : #http_request_getheader_name
24162478[ `request.setHeader()` ] : #http_request_setheader_name_value
@@ -2440,5 +2502,7 @@ not abort the request or do anything besides add a `'timeout'` event.
24402502[ `socket.unref()` ] : net.html#net_socket_unref
24412503[ `url.parse()` ] : url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost
24422504[ `HPE_HEADER_OVERFLOW` ] : errors.html#errors_hpe_header_overflow
2505+ [ `writable.destroy()` ] : stream.html#stream_writable_destroy_error
2506+ [ `writable.destroyed` ] : stream.html#stream_writable_destroyed
24432507[ `writable.cork()` ] : stream.html#stream_writable_cork
24442508[ `writable.uncork()` ] : stream.html#stream_writable_uncork
0 commit comments