Skip to content
Myr

Added custom redirect map support

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 7c2673f · Browse files · 2 files+16 added−0 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+16 added−0 removed

  • tests:+11 added−0 removed
  • other:+5 added−0 removed

2 files+16 added−0 removed

modified:lib/express/response.js+5 added
modified:test/response.test.js+11 added
96 unmodified lines
97 app2 = express.createServer();98 99 app2.set('home', '/blog');100101 app2.redirect = {102 google: 'http://google.com'103 };104105 app.get('/', function(req, res){106 res.redirect('http://google.com', 301);107 });108
16 unmodified lines
125 app2.get('/home', function(req, res){126 res.redirect('home');127 });128 129 app2.get('/google', function(req, res){130 res.redirect('google');131 });132 133 assert.response(app,134 { url: '/' },135 { body: '', status: 301, headers: { Location: 'http://google.com' }});136 assert.response(app,
17 unmodified lines
154 { body: '', status: 302, headers: { Location: '/blog' }});155 assert.response(app2,156 { url: '/home' },157 { body: '', status: 302, headers: { Location: '/blog' }});158 assert.response(app2,159 { url: '/google' },160 { body: '', headers: { Location: 'http://google.com' }});161 162 }163};