mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 00:19:48 +01:00
feat: add deprecation warnings for redirect arguments undefined (#6405)
This commit is contained in:
parent
7a9311216a
commit
c5b8d55a6a
|
|
@ -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');
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
"cookie": "^0.7.1",
|
||||
"cookie-signature": "^1.2.1",
|
||||
"debug": "^4.4.0",
|
||||
"depd": "^2.0.0",
|
||||
"encodeurl": "^2.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"etag": "^1.8.1",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user