title: Express req.query becoming null
body: <p>I have the following function which purpose will be to clean get parameters for a Restful api:</p>
  
  <pre><code>var clean_query = function(){
      return function(req, res, next){
           console.log(req.query)
           // Do stuff
           next();
      }
  }
  </code></pre>
  
  <p>What is really is strange is when I try this function, here is what I see in the console:</p>
  
  <pre><code>✔ Express server listening on port 3000 in development mode
  ✔ MongoDB connection done.
  ✔ Server launched
  
  { param1: 'toto', param2: 'titi' }
  
  /Users/... console.log(req.query)
                            ^
  TypeError: Cannot read property 'query' of null
  </code></pre>
  
  <p>The error message is pretty clear : it tells me req is null.... But if you check console output, you can see that console.log(req.query) is outputing the content to the console so it is not empty in reality.</p>
  
  <p>Do you know what can be my mistake? </p>
  
  <p>EDIT : my route handling:</p>
  
  <pre><code>app.get(uri, clean_query(), get_list_func(schema));
  </code></pre>
  
  <p>EDIT 2 : My middlewares:</p>
  
  <pre><code>app.use(express.logger('dev'));
  app.use(express.methodOverride());
  app.use(express.bodyParser());
  app.use(express.urlencoded());
  app.use(express.json());
  app.use(expressValidator());
  app.use(express.cookieParser('secret'));
  app.use(express.session( {
      store  : MongoStore( { db : 'dbtest' } ),
      key    : 'sessionid',
      cookie : { httpOnly : false },
      secret : 'secret'
  }, function() {
      app.use(app.router);
  }));
  app.use(passport.initialize());
  app.use(passport.session());
  </code></pre>
  
  <p>EDIT 3 : strange if i remove next from function parameter, there is no more error but i can't use the function like that as i need to chain it with other controllers.</p>
  
  <p>EDIT 4 : Wow, it seems that this function is called twice.... First time it is called req is ok, second time it is null. it must have something to do with next().</p>