diff --git a/lib/response.js b/lib/response.js index f965e539dd2..84ab9bfe834 100644 --- a/lib/response.js +++ b/lib/response.js @@ -838,13 +838,15 @@ 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(){ 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(){