Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -825,6 +826,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');

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down