mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 12:19:51 +01:00
This commit is contained in:
parent
a1fa90fcea
commit
a003cfab03
|
|
@ -1,3 +1,8 @@
|
|||
unreleased changes
|
||||
==========
|
||||
|
||||
* Allow passing non-strings to res.location with new encoding handling checks
|
||||
|
||||
4.19.0 / 2024-03-20
|
||||
==========
|
||||
|
||||
|
|
|
|||
|
|
@ -905,7 +905,7 @@ res.cookie = function (name, value, options) {
|
|||
*/
|
||||
|
||||
res.location = function location(url) {
|
||||
var loc = url;
|
||||
var loc = String(url);
|
||||
|
||||
// "back" is an alias for the referrer
|
||||
if (url === 'back') {
|
||||
|
|
|
|||
|
|
@ -145,5 +145,20 @@ describe('res', function(){
|
|||
.expect(200, done)
|
||||
})
|
||||
})
|
||||
|
||||
if (typeof URL !== 'undefined') {
|
||||
it('should accept an instance of URL', function (done) {
|
||||
var app = express();
|
||||
|
||||
app.use(function(req, res){
|
||||
res.location(new URL('http://google.com/')).end();
|
||||
});
|
||||
|
||||
request(app)
|
||||
.get('/')
|
||||
.expect('Location', 'http://google.com/')
|
||||
.expect(200, done);
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user