Skip to content

Commit

Permalink
fixed redirect for old URL: dailyjs/index
Browse files Browse the repository at this point in the history
  • Loading branch information
ekalinin committed Jul 9, 2011
1 parent 94d28dc commit e64d6ab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ app.get('/sitemap.xml', function (req, res) {
app.get('/', function (req, res) { res.redirect('/doc/'); });
app.get(/doc\/dailyjs\/web-app-(\d)/, function (req, res) {
res.redirect('/doc/dailyjs-nodepad/node-tutorial-'+req.params[0]); });
app.get(/doc\/dailyjs\/index/, function (req, res) {
res.redirect('/doc/dailyjs-nodepad/index'); });
app.get(/doc$/, function (req, res) { res.redirect('/doc/'); });
app.get(/doc\/([\w-\/]*)?$/, handleTrailSlash, function (req, res, next) {
var url = req.params[0],
Expand Down
14 changes: 14 additions & 0 deletions test/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ module.exports = {
);
},

// correct redirect for old URLs
'GET /doc/dailyjs/index': function() {
assert.response(app,
{ url: '/doc/dailyjs/index' },
{
status: 302,
headers: {
'Content-Type': 'text/html',
'Location': 'http://127.0.0.1:5555/doc/dailyjs-nodepad/index'
}
}
);
},

// redirect /doc --> /doc/
'GET /doc': function() {
assert.response(app,
Expand Down

0 comments on commit e64d6ab

Please sign in to comment.