Use res.end instead of this.body When redirect
See original GitHub issueMaybe should use res.end
instead of this.body=
ASAP.
redirect: function(url, alt){
// location
if ('back' == url) url = this.ctx.get('Referrer') || alt || '/';
this.set('Location', url);
// status
if (!statuses.redirect[this.status]) this.status = 302;
// html
if (this.ctx.accepts('html')) {
url = escape(url);
this.type = 'text/html; charset=utf-8';
this.body = 'Redirecting to <a href="' + url + '">' + url + '</a>.';
return;
}
// text
this.type = 'text/plain; charset=utf-8';
this.body = 'Redirecting to ' + url + '.';
},
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (10 by maintainers)
Top Results From Across the Web
Redirect after res.end() in nodejs - Stack Overflow
i am using jsonwebtoken to authenticate user. my ...
Read more >If it possible to do res.send() then res.redirect() ? : r/node
Basically when you do res.send() , the response is sent and the connection is closed from there. so you can't continue to do...
Read more >Express.js res.redirect() Function - GeeksforGeeks
The res.redirect() function redirects to the URL derived from the specified path, with specified status, a integer (positive) which ...
Read more >5.x API - Express.js
A new body object containing the parsed data is populated on the request object ... When a file is not found, instead of...
Read more >res.redirect() - Sails.js
A back redirect, which allows you to redirect a request back from whence it came from using the "Referer" (or "Referrer") header (if...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m a little worried this could break the middleware chain? Would love to see some tests …
I think a benchmark would be more helpful to see what’s the difference between them @fundon.