Skip to content
Myr

Merge branch 'master' of github.com:visionmedia/express

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by TJ Holowaychuk · committed by TJ Holowaychuk · parents 060653b, 5cf29a3 · Browse files · 2 files+18 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+18 added−1 removed

  • tests:+17 added−0 removed
  • other:+1 added−1 removed

2 files+18 added−1 removed

modified:lib/response.js+1 added-1 removed
654 unmodified lines
655656 // Support text/{plain,html} by default657 this.format({658 text: function(){659 body = statusCodes[status] + '. Redirecting to ' + url;659 body = statusCodes[status] + '. Redirecting to ' + encodeURI(url);660 },661662 html: function(){663 var u = utils.escape(url);
54 unmodified lines
modified:test/res.redirect.js+17 added
285 unmodified lines
286 res.text.should.equal('Moved Temporarily. Redirecting to http://google.com');287 done();288 })289 })290291 it('should encode the url', function(done){292 var app = express();293294 app.use(function(req, res){295 res.redirect('http://example.com/?param=<script>alert("hax");</script>');296 });297298 request(app)299 .get('/')300 .set('Host', 'http://example.com')301 .set('Accept', 'text/plain, */*')302 .end(function(err, res){303 res.text.should.equal('Moved Temporarily. Redirecting to http://example.com/?param=%3Cscript%3Ealert(%22hax%22);%3C/script%3E');304 done();305 })306 })307 })308309 describe('when accepting neither text or html', function(){310 it('should respond with an empty body', function(done){
20 unmodified lines