From e835966e1c4fcb6edae439a02001328ffaba1d17 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Thu, 26 Jan 2023 12:04:29 +0100 Subject: [PATCH] http: res.setHeader 18.x backport --- lib/_http_server.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/_http_server.js b/lib/_http_server.js index 94f2d899e13a27..b46e7b0906dfea 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -378,6 +378,9 @@ function writeHead(statusCode, reason, obj) { if (k) this.setHeader(k, obj[k]); } } + if (k === undefined && this._header) { + throw new ERR_HTTP_HEADERS_SENT('render'); + } // Only progressive api is used headers = this[kOutHeaders]; } else {