Skip to content

Commit 93ca4f4

Browse files
ronagtargos
authored andcommitted
doc: deprecate http finished
PR-URL: #28679 Refs: #28651 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 0022d75 commit 93ca4f4

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

doc/api/deprecations.md

+25
Original file line numberDiff line numberDiff line change
@@ -2548,6 +2548,27 @@ APIs that do not make sense to use in userland. File streams should always be
25482548
opened through their corresponding factory methods [`fs.createWriteStream()`][]
25492549
and [`fs.createReadStream()`][]) or by passing a file descriptor in options.
25502550
2551+
<a id="DEP0136"></a>
2552+
### DEP0136: http finished
2553+
<!-- YAML
2554+
changes:
2555+
- version: REPLACEME
2556+
pr-url: https://github.com/nodejs/node/pull/28679
2557+
description: Documentation-only deprecation.
2558+
-->
2559+
2560+
Type: Documentation-only
2561+
2562+
[`response.finished`][] indicates whether [`response.end()`][] has been
2563+
called, not whether `'finish'` has been emitted and the underlying data
2564+
is flushed.
2565+
2566+
Use [`response.writableFinished`][] or [`response.writableEnded`][]
2567+
accordingly instead to avoid the ambigiuty.
2568+
2569+
To maintain existing behaviour `response.finished` should be replaced with
2570+
`response.writableEnded`.
2571+
25512572
[`--pending-deprecation`]: cli.html#cli_pending_deprecation
25522573
[`--throw-deprecation`]: cli.html#cli_throw_deprecation
25532574
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
@@ -2610,6 +2631,10 @@ and [`fs.createReadStream()`][]) or by passing a file descriptor in options.
26102631
[`request.connection`]: http.html#http_request_connection
26112632
[`response.socket`]: http.html#http_response_socket
26122633
[`response.connection`]: http.html#http_response_connection
2634+
[`response.end()`]: http.html#http_response_end_data_encoding_callback
2635+
[`response.finished`]: #http_response_finished
2636+
[`response.writableFinished`]: #http_response_writablefinished
2637+
[`response.writableEnded`]: #http_response_writableended
26132638
[`script.createCachedData()`]: vm.html#vm_script_createcacheddata
26142639
[`setInterval()`]: timers.html#timers_setinterval_callback_delay_args
26152640
[`setTimeout()`]: timers.html#timers_settimeout_callback_delay_args

doc/api/http.md

+8
Original file line numberDiff line numberDiff line change
@@ -623,8 +623,11 @@ is finished.
623623
### request.finished
624624
<!-- YAML
625625
added: v0.0.1
626+
deprecated: REPLACEME
626627
-->
627628

629+
> Stability: 0 - Deprecated. Use [`request.writableEnded`][].
630+
628631
* {boolean}
629632

630633
The `request.finished` property will be `true` if [`request.end()`][]
@@ -1305,8 +1308,11 @@ is finished.
13051308
### response.finished
13061309
<!-- YAML
13071310
added: v0.0.2
1311+
deprecated: REPLACEME
13081312
-->
13091313

1314+
> Stability: 0 - Deprecated. Use [`response.writableEnded`][].
1315+
13101316
* {boolean}
13111317

13121318
The `response.finished` property will be `true` if [`response.end()`][]
@@ -2417,12 +2423,14 @@ not abort the request or do anything besides add a `'timeout'` event.
24172423
[`request.socket.getPeerCertificate()`]: tls.html#tls_tlssocket_getpeercertificate_detailed
24182424
[`request.socket`]: #http_request_socket
24192425
[`request.writableFinished`]: #http_request_writablefinished
2426+
[`request.writableEnded`]: #http_request_writableended
24202427
[`request.write(data, encoding)`]: #http_request_write_chunk_encoding_callback
24212428
[`response.end()`]: #http_response_end_data_encoding_callback
24222429
[`response.getHeader()`]: #http_response_getheader_name
24232430
[`response.setHeader()`]: #http_response_setheader_name_value
24242431
[`response.socket`]: #http_response_socket
24252432
[`response.writableFinished`]: #http_response_writablefinished
2433+
[`response.writableEnded`]: #http_response_writableended
24262434
[`response.write()`]: #http_response_write_chunk_encoding_callback
24272435
[`response.write(data, encoding)`]: #http_response_write_chunk_encoding_callback
24282436
[`response.writeContinue()`]: #http_response_writecontinue

doc/api/http2.md

+4
Original file line numberDiff line numberDiff line change
@@ -3075,8 +3075,11 @@ is finished.
30753075
#### response.finished
30763076
<!-- YAML
30773077
added: v8.4.0
3078+
deprecated: REPLACEME
30783079
-->
30793080

3081+
> Stability: 0 - Deprecated. Use [`response.writableEnded`][].
3082+
30803083
* {boolean}
30813084

30823085
Boolean value that indicates whether the response has completed. Starts
@@ -3559,6 +3562,7 @@ following additional properties:
35593562
[`response.end()`]: #http2_response_end_data_encoding_callback
35603563
[`response.setHeader()`]: #http2_response_setheader_name_value
35613564
[`response.socket`]: #http2_response_socket
3565+
[`response.writableEnded`]: #http2_response_writableended
35623566
[`response.write()`]: #http2_response_write_chunk_encoding_callback
35633567
[`response.write(data, encoding)`]: http.html#http_response_write_chunk_encoding_callback
35643568
[`response.writeContinue()`]: #http2_response_writecontinue

0 commit comments

Comments
 (0)