Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove res.redirect(url, status) signature #2941

Closed
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
3 changes: 3 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

This incorporates all changes after 4.13.1 up to 4.14.0.

* remove:
- `res.redirect(url, status)` signature - use `res.redirect(status, url)`

5.0.0-alpha.2 / 2015-07-06
==========================

Expand Down
9 changes: 2 additions & 7 deletions lib/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -759,13 +759,8 @@ res.redirect = function redirect(url) {

// allow status / url
if (arguments.length === 2) {
if (typeof arguments[0] === 'number') {
status = arguments[0];
address = arguments[1];
} else {
deprecate('res.redirect(url, status): Use res.redirect(status, url) instead');
status = arguments[1];
}
status = arguments[0];
address = arguments[1];
}

// Set location header
Expand Down
15 changes: 0 additions & 15 deletions test/res.redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,6 @@ describe('res', function(){
})
})

describe('.redirect(url, status)', function(){
it('should set the response status', function(done){
var app = express();

app.use(function(req, res){
res.redirect('http://google.com', 303);
});

request(app)
.get('/')
.expect('Location', 'http://google.com')
.expect(303, done)
})
})

describe('when the request method is HEAD', function(){
it('should ignore the body', function(done){
var app = express();
Expand Down