From 0cb553a0f384962251fc57ea88755a4e1a895dd7 Mon Sep 17 00:00:00 2001 From: Weixie Cui Date: Fri, 20 Feb 2026 19:56:43 +0800 Subject: [PATCH 1/2] fix: non standard status code will result in undefined --- lib/response.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/response.js b/lib/response.js index f965e539dd2..bf965ef1def 100644 --- a/lib/response.js +++ b/lib/response.js @@ -838,7 +838,8 @@ res.redirect = function redirect(url) { // Support text/{plain,html} by default this.format({ text: function(){ - body = statuses.message[status] + '. Redirecting to ' + address + var statusMessage = statuses.message[status] || String(status); + body = statusMessage + '. Redirecting to ' + address }, html: function(){ From d6fe76285744828c17d63c7bf1c313a1b1792728 Mon Sep 17 00:00:00 2001 From: Weixie Cui Date: Sun, 22 Feb 2026 21:19:53 +0800 Subject: [PATCH 2/2] fix: handle non-standard status code in html --- lib/response.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/response.js b/lib/response.js index bf965ef1def..84ab9bfe834 100644 --- a/lib/response.js +++ b/lib/response.js @@ -844,8 +844,9 @@ res.redirect = function redirect(url) { html: function(){ var u = escapeHtml(address); + var statusMessage = statuses.message[status] || String(status); body = '' + statuses.message[status] + '' - + '

' + statuses.message[status] + '. Redirecting to ' + u + '

' + + '

' + statusMessage + '. Redirecting to ' + u + '

' }, default: function(){