title: NodeJS POST Request Over JSON-RPC
body: <p>I am trying to execute a POST request over JSON-RPC on my NodeJS server. Converting the following curl command:</p>
  
  <pre><code>curl -X POST --data '{"jsonrpc":"2.0","method":"personal_newAccount","params":["pass"],"id":74}' http://localhost:8545
  </code></pre>
  
  <p>In NodeJS I keep receiving: </p>
  
  <pre><code>200 {"id":-1,"jsonrpc":"2.0","error":{"code":-32600,"message":"Could not decode request"}}
  </code></pre>
  
  <p>In the header I am specifying the Content-Type. If someone can point out what I am not specifying and how to add it in it would be much appreciated.</p>
  
  <pre><code>var headers = {
      'User-Agent':       'Super Agent/0.0.1',
      'Content-Type':     'application/json-rpc',
      'Accept':'application/json-rpc'
  }
  
  var options = {
      url: "http://localhost:8545",
      method: 'POST',
      headers: headers,
      form: {"jsonrpc":"2.0","method":"personal_newAccount","params":["pass"],"id":1}
  }
  
  request(options, function (error, response, body) {
      if (!error &amp;&amp; response.statusCode == 200) {
          res.writeHeader(200, {"Content-Type": "text/plain"});
          res.write(res.statusCode.toString() + " " + body);
      }else{
        res.writeHeader(response.statusCode, {"Content-Type": "text/plain"});
        res.write(response.statusCode.toString() + " " + error);
      }
      res.end();
  })
  </code></pre>