This time I try to connect to the RPC interface using NodeJS
The code:
var request = require('request');
request.post("http://localhost:19988/rpc/", {
json: {"method":"about","params":[],"json-rpc": 2.0,"id":0} },
function (error, response, body) {
console.log(body);
}
).auth('xeroc', 'secret');
The transmitted message:
POST /rpc/ HTTP/1.1
host: localhost:19988
accept: application/json
content-type: application/json
content-length: 50
authorization: Basic authentication-hash
Connection: keep-alive
{"method":"about","params":[],"json-rpc":2,"id":0}
The result:
Unauthorized
As a reference, the curl message that result in the desired about message:
POST /rpc HTTP/1.1
Authorization: Basic authentication-hash
User-Agent: curl/7.37.0
Host: localhost:19988
Accept: */*
Content-Length: 58
Content-Type: application/x-www-form-urlencoded
{"method":"about", "params": [], "json-rpc": 2.0, "id": 0}
What am I missing?