title: Posting request to node.js service results in timeout
body: <p>Getting my head around node.js and have developed a simple service:</p>
  
  <pre><code>// set up ======================================================================
  var express = require('express');
  var app = express();                               // create our app w/ express
  var port = process.env.PORT || 8080;                // set the port
  
  var bodyParser = require('body-parser');
  //var methodOverride = require('method-override')
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({extended: true}));
  
  app.use(function (req, res, next) {
      //the code hits this point!
      var data = '';
      req.on('data', function (chunk) {
          data += chunk;
      });
      req.on('end', function () {
          req.rawBody = data;
          next();
      });
      //console.log(data);
  });
  //app.use(methodOverride());
  // routes ======================================================================
  require('./routes.js')(app);
  
  // listen (start app with node server.js) ======================================
  app.listen(port);
  console.log("App listening on port " + port);
  </code></pre>
  
  <p>routes.js</p>
  
  <pre><code>var _ = require('underscore');
  
  module.exports = function (app) {
      app.post('/', function (req, res) {
          var Validator = require('jsonschema').Validator;
          var v = new Validator();
          var jso = req.rawBody;
          var newjso = JSON.parse(req.rawBody);
          var schema={
              "description": "A payload",
              "type": "object"
          };
  
          var result = v.validate(newjso,schema);
  
          console.log('----------------------payload--------------------------------------')
          console.log(newjso);
          console.log('------------------end payload--------------------')
  
          if (result.errors.length &gt; 0) {
              res.setHeader('content-type', 'application/json');
              res.status(400);
              res.json({
                  "error": "Could not decode request: JSON parsing failed"
              });
              console.log('------------------ERROR!!!--------------------')
          }
          else
          {
              var resp = _.filter(_.where(newjso.payload, {drm: true}), function (item) {
                  return item.episodeCount &gt; 0
              });
  
              var newArray = [];
              resp.forEach(function (item) {
                  var newItem = _.pick(item, 'image', 'slug', 'title');
                  newItem.image = _.propertyOf(newItem.image)('showImage');
                  newArray.push(newItem);
              })
  
              res.setHeader('content-type', 'application/json');
              res.status(200);
              res.json({response: newArray});
          }
      })
  }
  </code></pre>
  
  <p>When I post this or any other json to postman:</p>
  
  <pre><code>{
    "payload": [
      {
      }]
  }
  </code></pre>
  
  <p>It looks like it is timing out when the Contenttypeheader = application/json is specified. Why is it timing out and how can I fix this in my node.js program?
  <img src="https://i.stack.imgur.com/hii1m.jpg" alt="postman piccie"></p>