title: Calling NetSuite restlet from Node
body: <p>I'm trying to call a restlet from nodejs; it's a simple post with some authorization but all I get is some error : </p>
  
  <p>{"error" : {"code" : "SYNTAX_ERROR", "message" : "SyntaxError: Empty JSON string (null$lib#3)."}}</p>
  
  <p>Here's my code </p>
  
  <pre><code>request.post({
        url: netSuiteUrl
        headers: {
          'Content-Type': 'application/json'
          'Authorization': 'NLAuth nlauth_account=&lt;account&gt;, nlauth_email=&lt;email&gt;, nlauth_signature=&lt;username&gt;, nlauth_role=3'
        }
        content: '{"data":"test"}'
      }, (error, response, body) -&gt;
        console.log(body)
      )
  </code></pre>
  
  <p>The restlet actually receives the call and authorization is working. The same data I'm sending works fine with the following PHP code:</p>
  
  <pre><code>$opts = array(
  'http' =&gt; array(
      'method' =&gt; "POST",
      'header' =&gt;  "Authorization: NLAuth nlauth_account=&lt;account&gt;, nlauth_email=&lt;email&gt;, nlauth_signature=&lt;signature&gt;, nlauth_role=3\r\n" .
                  "Content-Type: application/json\r\n",
      'content': '{"data":"test"}'
      )
  );
  
  $context = stream_context_create($opts);
  $file = file_get_contents($url, false, $context);
  </code></pre>
  
  <p>Any hint?</p>