我想通过HTTP请求得到结果,我想知道如何解析post参数并得到结果。
var http = require("http");
var email = "email";
var password = '12345';
var response_string='010000000157065146a6b32b224b87d47c1b0283b1ae2fa5bd4f9af9ebc45928110f87fbae00000000700';
var post_params="jsonrpc= 1.0&id=curltest&method=decoderawtransaction¶ms="+response_string;
http.request({
host: "127.0.0.1",
port:"8332",
path:"/path",
method: "POST",
headers: {
"Authorization": "Basic " + new Buffer( email + ":" + password ).toString('base64')
}
}, function(res){
var response = "";
res.on('data', function(chunk){
response += chunk;
console.log("res"+response);
});
res.on('end',function(){
response = JSON.parse(response);
console.log("res1"+response);
});
}).end();
如何在请求中解析post_params变量。