feat: add deprecation warnings for redirect arguments undefined (#6405)

This commit is contained in:
Sebastian Beltran
2025-07-14 22:18:10 -05:00
committed by GitHub
parent 7a9311216a
commit c5b8d55a6a
2 changed files with 14 additions and 0 deletions

View File

@@ -14,6 +14,7 @@
var contentDisposition = require('content-disposition');
var createError = require('http-errors')
var deprecate = require('depd')('express');
var encodeUrl = require('encodeurl');
var escapeHtml = require('escape-html');
var http = require('node:http');
@@ -826,6 +827,18 @@ res.redirect = function redirect(url) {
address = arguments[1]
}
if (!address) {
deprecate('Provide a url argument');
}
if (typeof address !== 'string') {
deprecate('Url must be a string');
}
if (typeof status !== 'number') {
deprecate('Status must be a number');
}
// Set location header
address = this.location(address).get('Location');