title: SyntaxError: Unexpected end of input at Object.parse (native) npm request
body: <p>Hello I don't understand why I have this error, I thought the callback was executed once the data has been received, any idea where this come from ?
  Thanks a lot!</p>
  
  <p>Node error:</p>
  
  <pre><code>SyntaxError: Unexpected end of input
    at Object.parse (native)
  </code></pre>
  
  <p>I parse the body's answer send it to a calculate function before sending it to the page =/</p>
  
  <pre><code>var options = {
          method: 'POST',
          url: self.rippledataapiProxyHost.account_offers_exercised,
          headers: {
              "Content-Type": "application/json",
              "Accept": "application/json"
          },
          body:parameters 
      };
  
      var callback = function(error, response, body) {
          if (error) {
              console.log('error', error);
              res.send(500, 'something went wrong');
          }
          console.dir("bodyyyyyyyy====&gt;",body);
          var rippleoffersexercised = new self.datacalcul.rippleoffersexercised;
          var data = JSON.parse(body);
          var datas = rippleoffersexercised.calculate(data);
          res.status(response.statusCode).send(datas);
      }
      request(options, callback);
  </code></pre>
  
  <p>Here is the stack trace:</p>
  
  <pre><code>'bodyyyyyyyy====&gt;'
  
  SyntaxError: Unexpected end of input
    at Object.parse (native)
    at Request.callback [as _callback] (/home/francois/dev/ripplereport/webserver-newclientFrancois/server/middlewares/proxy/rippledataapiProxy.js:77:20)
    at Request.self.callback (/home/francois/dev/ripplereport/webserver-newclientFrancois/node_modules/request/request.js:344:22)
    at Request.emit (events.js:98:17)
    at Request.&lt;anonymous&gt; (/home/francois/dev/ripplereport/webserver-newclientFrancois/node_modules/request/request.js:1239:14)
    at Request.emit (events.js:117:20)
    at IncomingMessage.&lt;anonymous&gt; (/home/francois/dev/ripplereport/webserver-newclientFrancois/node_modules/request/request.js:1187:12)
    at IncomingMessage.emit (events.js:117:20)
    at _stream_readable.js:943:16
    at process._tickCallback (node.js:419:13)
  
  [gulp] [nodemon] app crashed - waiting for file changes before starting...
  </code></pre>