From d326364cd04ce0c856c359c576d8a65fca78fea3 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Thu, 16 Feb 2017 13:10:21 -0800 Subject: [PATCH] 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. --- doc/api/deprecations.md | 11 +++++++++++ lib/_http_server.js | 5 ++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 1ee1c40ee882ad..7b37e276abfa26 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -523,6 +523,17 @@ Type: Runtime of V8 5.8. It is replaced by Inspector which is activated with `--inspect` instead. + +#### DEP0063: ServerResponse.prototype.writeHeader() + +Type: Documentation-only + +The `http` module `ServerResponse.prototype.writeHeader()` API has been +deprecated. Please use `ServerResponse.prototype.writeHead()` instead. + +*Note*: The `ServerResponse.prototype.writeHeader()` method was never documented +as an officially supported API. + [alloc]: buffer.html#buffer_class_method_buffer_alloc_size_fill_encoding [alloc_unsafe_size]: buffer.html#buffer_class_method_buffer_allocunsafe_size [`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size diff --git a/lib/_http_server.js b/lib/_http_server.js index 73e0b2c14ae532..082920839459e9 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -231,9 +231,8 @@ function writeHead(statusCode, reason, obj) { this._storeHeader(statusLine, headers); } -ServerResponse.prototype.writeHeader = function writeHeader() { - this.writeHead.apply(this, arguments); -}; +// Docs-only deprecated: DEP0063 +ServerResponse.prototype.writeHeader = ServerResponse.prototype.writeHead; function Server(requestListener) {