title: Unexpected newline characters using nodejs/express
body: <p>I'm working my way through an example using Nodejs &amp; Express.  When trying it I get an error.</p>
  
  <p>A portion of the main file:</p>
  
  <pre><code>    app.post('/send', express.bodyParser(), function(req, res) {
      if(req.body &amp;&amp; req.body.tweet) {
          tweets.push(req.body.tweet);
          res.send({status:"ok",message:"Tweet received"});
      } else {
          res.send({status: "nok", message: "No tweet received"});    
      }
  </code></pre>
  
  <p>});</p>
  
  <p>A portion of the test script:</p>
  
  <pre><code>    var req = http.request(opts, function(res) {
  res.setEncoding('utf8');
  
  var data = "";
  res.on('data', function(d) {
      data += d;  
  });
  res.on('end', function() {
      assert.strictEqual(data, '{"status":"ok","message":"Tweet received"}');
  });
  </code></pre>
  
  <p>});        </p>
  
  <p>This is the error:</p>
  
  <pre><code>assert.js:104
    throw new assert.AssertionError({
          ^
  AssertionError: "{\n  \"status\": \"ok\",\n  \"message\": \"Tweet received\"\n}" === "{\"status\":\"ok\",\"message\":\"Tweet received\"}"
      at IncomingMessage.&lt;anonymous&gt; (/home/jfb/Documents/Info/Nodejs/Up_and_Running/test.js:19:11)
      at IncomingMessage.EventEmitter.emit (events.js:115:20)
      at IncomingMessage._emitEnd (http.js:366:10)
      at HTTPParser.parserOnMessageComplete [as onMessageComplete] (http.js:149:23)
      at Socket.socketOnData [as ondata] (http.js:1356:20)
      at TCP.onread (net.js:404:27)
  </code></pre>
  
  <p>I checked my file with an editor set to display special characters and there were no newline characters as shown by the error message.</p>
  
  <p>Could someone tell me what is happening here.</p>
  
  <p>Thanks,  Jim</p>