diff --git a/lib/http.js b/lib/http.js index 562aaa0a50..51980d810b 100644 --- a/lib/http.js +++ b/lib/http.js @@ -68,6 +68,7 @@ app.init = function(middleware){ this.set('home', '/'); this.set('env', process.env.NODE_ENV || 'development'); + this.use(connect.query()); // expose objects to each other this.use(function(req, res, next){ @@ -82,12 +83,6 @@ app.init = function(middleware){ // charset if (charset = self.set('charset')) res.charset = charset; - // assign req.query - if (req.url.indexOf('?') > 0) { - var query = url.parse(req.url).query; - req.query = qs.parse(query); - } - /** * Assign several locals with the given `obj`, * or return the locals. diff --git a/test/express.test.js b/test/express.test.js index 1d5a124cbf..63abb7212a 100644 --- a/test/express.test.js +++ b/test/express.test.js @@ -289,26 +289,6 @@ module.exports = { app.disabled('something else').should.be.true; }, - 'test middleware precedence': function(){ - var app = express.createServer(); - - app.use(connect.bodyParser()); - - assert.equal(2, app.stack.length); - - app.post('/', function(req, res){ - res.send(JSON.stringify(req.body || '')); - }); - app.get('/', function(){ - - }); - assert.equal(3, app.stack.length); - - assert.response(app, - { url: '/', method: 'POST', data: 'name=tj', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }}, - { body: '{"name":"tj"}' }); - }, - 'test mounting': function(){ var called , app = express.createServer()