Skip to content

Commit fb71ba4

Browse files
committed
http: docs-only deprecation of res.writeHeader()
Doc-only deprecation of the undocumented res.writeHeader() API. Also makes res.writeHeader an alias of res.writeHead since the previous implementation simply deferred to that method. PR-URL: #11355 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rod Vagg <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
1 parent d4e1eaf commit fb71ba4

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

doc/api/deprecations.md

+11
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,17 @@ Type: Runtime
523523
of V8 5.8. It is replaced by Inspector which is activated with `--inspect`
524524
instead.
525525

526+
<a id="DEP0063"></a>
527+
#### DEP0063: ServerResponse.prototype.writeHeader()
528+
529+
Type: Documentation-only
530+
531+
The `http` module `ServerResponse.prototype.writeHeader()` API has been
532+
deprecated. Please use `ServerResponse.prototype.writeHead()` instead.
533+
534+
*Note*: The `ServerResponse.prototype.writeHeader()` method was never documented
535+
as an officially supported API.
536+
526537
[alloc]: buffer.html#buffer_class_method_buffer_alloc_size_fill_encoding
527538
[alloc_unsafe_size]: buffer.html#buffer_class_method_buffer_allocunsafe_size
528539
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size

lib/_http_server.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,8 @@ function writeHead(statusCode, reason, obj) {
231231
this._storeHeader(statusLine, headers);
232232
}
233233

234-
ServerResponse.prototype.writeHeader = function writeHeader() {
235-
this.writeHead.apply(this, arguments);
236-
};
234+
// Docs-only deprecated: DEP0063
235+
ServerResponse.prototype.writeHeader = ServerResponse.prototype.writeHead;
237236

238237

239238
function Server(requestListener) {

0 commit comments

Comments
 (0)