阅读http获取请求的响应

我怎样才能读取从http获取的init响应? 基本上我的代码是这样的,但我不能达到这些对象。

var request = require("request") request({ url: "http://xxx/xxx/get.php?act=init&aparam=parame", method:"get", json: true }, function (error, response, body) { console.log(response.toJSON);// why i cant reach every object etc from here like this }); 

回应就是这样

 IncomingMessage { _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: BufferList { head: null, tail: null, length: 0 }, length: 0, pipes: null, },.../// continues... 

https://www.npmjs.com/package/request

你可以像这样访问body param的结果

 var request = require('request'); request('http://www.google.com', function (error, response, body) { console.log('error:', error); // Print the error if one occurred console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received console.log('body:', body); // Print the HTML for the Google homepage. });