From e8f542e4b067929774c29b294640c563dc8aec64 Mon Sep 17 00:00:00 2001 From: Johnny Huirilef Date: Tue, 20 Oct 2026 17:11:12 -0300 Subject: [PATCH 1/2] fix: use the status code as the error body when it has no name In production, getErrorMessage() fell back to statuses.message[status], which is undefined for a valid error status that has no name, such as 499. The response body was
undefined
. Fall back to the status code itself, as res.sendStatus() does in Express. --- HISTORY.md | 1 + index.js | 2 +- test/test.js | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 5e36579..9c5f528 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,6 +1,7 @@ unreleased ================== + * fix: use the status code as the error body when it has no name * deps: * debug@^4.4.3 * statuses@^2.0.2 diff --git a/index.js b/index.js index 862421c..e1e4a6e 100644 --- a/index.js +++ b/index.js @@ -167,7 +167,7 @@ function getErrorMessage (err, status, env) { } } - return msg || statuses.message[status] + return msg || statuses.message[status] || String(status) } /** diff --git a/test/test.js b/test/test.js index 516e088..c463b3b 100644 --- a/test/test.js +++ b/test/test.js @@ -351,6 +351,17 @@ var topDescribe = function (type, createServer) { .expect(501, /
Not Implemented<\/pre>/, done)
     })
 
+    it('should send status code when production and no status code name', function (done) {
+      var err = createError('boom!', {
+        status: 499
+      })
+      wrapper(request(createServer(err, {
+        env: 'production'
+      }))
+        .get('/foo'))
+        .expect(499, /
499<\/pre>/, done)
+    })
+
     describe('when there is a request body', function () {
       it('should not hang/error when unread', function (done) {
         var buf = Buffer.alloc(1024 * 16, '.')

From 6da15d3779f1f82c707af9ab9704d9d081662e3e Mon Sep 17 00:00:00 2001
From: Phillip Barta 
Date: Wed, 21 Oct 2026 17:48:23 +0200
Subject: [PATCH 2/2] ci: pin to supertest 7.3.0 because of streaming request
 regression in 7.3.1 Ref: https://github.com/forwardemail/supertest/issues/911

---
 package.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package.json b/package.json
index de69a68..596bc89 100644
--- a/package.json
+++ b/package.json
@@ -28,7 +28,7 @@
     "eslint-plugin-standard": "^4.1.0",
     "mocha": "^11.0.1",
     "nyc": "^17.1.0",
-    "supertest": "^7.0.0"
+    "supertest": "7.3.0"
   },
   "files": [
     "index.js"