senchalabs/connect — pull request #481 by papandreou (2012-02-24 13:37:07+00:00)
Title: Report the original url in the 'Cannot...' message when no route matches

When some middleware rewrites req.url, the rewritten url is used in the 'Cannot...' message emitted by connect if it turns out that no route matches. That's a bit confusing.

Example: If a client requests `/foo/bar/quux/` from the below server, the error message will say `Cannot GET /bar/quux/`:

var app = require('connect')()
.use(function removeFirstFragment(req, res, next) {
req.url = req.url.replace(/^\/[^\/]+/, '');
next();
});
require('http').createServer(app).listen(4000);