Skip to content
Myr

Added res.redirect() mount test

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 · parent 7822d1f · Browse files · 2 files+24 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+24 added−1 removed

  • tests:+21 added−0 removed
  • other:+3 added−1 removed

2 files+24 added−1 removed

modified:lib/response.js+3 added-1 removed
340 unmodified lines
341 this.header('Content-Type', 'text/plain');342 }343344 // Respond345 this.send(body, { Location: url }, status);345 this.statusCode = status;346 this.header('Location', url);347 this.end(body);348};349350/**351 * Assign the view local variable `name` to `val` or return the
14 unmodified lines
modified:test/response.test.js+21 added
290 unmodified lines
291 { url: '/user/12', headers: { Accept: 'text/plain' }},292 { body: 'Moved Temporarily. Redirecting to /user/12/blog'293 , status: 302, headers: { Location: '/user/12/blog', 'X-Foo': 'bar' }});294 },295296 'test #redirect() when mounted': function(){297 var app = express.createServer()298 , blog = express.createServer();299300301 blog.get('/posts', function(req, res){302 res.redirect('/posts/all');303 });304305 blog.get('/posts/all', function(req, res){306 res.send('all blog posts');307 });308309 app.use('/blog', blog);310311 assert.response(app,312 { url: '/blog/posts' },313 { status: 302314 , headers: { Location: '/blog/posts/all' }});315 },316 317 'test #sendfile()': function(){318 var app = express.createServer();319
247 unmodified lines