From 0d3ac3039f8145b03a93543e5b8d0af86a1b4dc6 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Fri, 18 Nov 2022 18:06:48 +0100 Subject: [PATCH] fix: changed error label --- lib/_http_server.js | 2 +- test/parallel/test-http-write-head.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/_http_server.js b/lib/_http_server.js index 26adf5af320bc8..1783a407370656 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -333,7 +333,7 @@ ServerResponse.prototype.writeHead = writeHead; function writeHead(statusCode, reason, obj) { if (this._header) { - throw new ERR_HTTP_HEADERS_SENT('writeHead'); + throw new ERR_HTTP_HEADERS_SENT('write'); } const originalStatusCode = statusCode; diff --git a/test/parallel/test-http-write-head.js b/test/parallel/test-http-write-head.js index 85052ad59c1c57..2f58e27851524b 100644 --- a/test/parallel/test-http-write-head.js +++ b/test/parallel/test-http-write-head.js @@ -58,7 +58,7 @@ const s = http.createServer(common.mustCall((req, res) => { }, { code: 'ERR_HTTP_HEADERS_SENT', name: 'Error', - message: 'Cannot writeHead headers after they are sent to the client' + message: 'Cannot write headers after they are sent to the client' }); res.end(); @@ -83,7 +83,7 @@ function runTest() { assert.throws(() => res.writeHead(200, [ 'test2', '2' ]), { code: 'ERR_HTTP_HEADERS_SENT', name: 'Error', - message: 'Cannot writeHead headers after they are sent to the client' + message: 'Cannot write headers after they are sent to the client' }); res.end(); });