title: node.js req.body empty when sending from java with httpPost
body: <p>When I'm trying to send some json to my node.js server req.body is empty and I have no idea why. The headers I'm sending are received.</p>
  
  <p>This is the java code:</p>
  
  <pre><code>        HttpClient httpClient = new DefaultHttpClient();
          HttpPost httpPost = new HttpPost(url);
          StringEntity se = new StringEntity(json, "UTF8");
  
          httpPost.setEntity(se);
          httpPost.setHeader("Accept", "application/json");
          httpPost.setHeader("Content-type", "application/json");
          httpPost.setHeader("test", "test");
  
          HttpResponse httpResponse = httpClient.execute(httpPost);
  </code></pre>
  
  <p>And this is the node.js code:</p>
  
  <pre><code>exports.checkMail = function(req, res) {
      var user = req.body;
      var header = req.headers;
      var email = user.email;
      db.collection('users', function(err, collection) {
          collection.findOne({'email':email}, function(err, item) {
              if (item) {
                  res.send({'error':0, 'message':'email available'});
              } else {
                  res.send({'error':4, 'message':'email already taken'});
              }
          });
      });
  };
  </code></pre>
  
  <p>Any ideas of what I might be missing?</p>
  
  <p>EDIT:</p>
  
  <p>Sorry forgot to mention. I'm using Express.
  And the json i'm sending is:</p>
  
  <pre><code>{"email":"email@email.com"}
  </code></pre>
  
  <p>What I get from req.body is just: {}</p>
  
  <p>EDIT2:</p>
  
  <p>app.js</p>
  
  <pre><code>    var express = require('express'),
          post = require('./routes/posts'),
          user = require('./routes/user');
  
      var app = express();
  
      app.configure(function () {
          app.use(express.logger('dev'));
          app.use(express.bodyParser());
          //app.use(express.json());
          //app.use(express.urlencoded());
      });
  
      app.get('/auth',            user.login); 
      app.post('/auth',           user.addUser);
      app.put('/auth/:id',        user.updateUser); 
      app.post('/checkmail',      user.checkMail);  
      app.post('/reset',          user.resetPassword); 
  
      app.listen(8080);
      console.log('Listening on port 8080...');
  </code></pre>