I am currently trying to call a remote API from a node.js application that I am writing using needle. The API requires that I make all requests as post requests. when I try to print out the response.body in the console log the only thing that prints out is <Buffer >
.
My node.js code is as follows:
var needle = require('needle');
var options = {
data: { "username": "**********", "password":"******************" },
headers: { "Accept":"application/json", "Accept-Encoding":"gzip,deflate", "Content-Type":"application/json" }
};
needle.post('http://www.linxup.com/ibis/rest/linxupmobile/map', options, function(err, resp, body) {
// you can pass params as a string or as an object.
console.log(body.toString());
Additionally I have tried printing resp, resp.body, body, and all of the aforementioned items with the .toString() method attached. I just want to be able to see the response data returned from the API POST call.