Skip to content

Commit

Permalink
utilize connects new query() middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Jul 15, 2011
1 parent 9a8b868 commit eab03fd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 26 deletions.
7 changes: 1 addition & 6 deletions lib/http.js
Expand Up @@ -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){
Expand All @@ -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.
Expand Down
20 changes: 0 additions & 20 deletions test/express.test.js
Expand Up @@ -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()
Expand Down

0 comments on commit eab03fd

Please sign in to comment.