first of all i am quite knew at webservices and javascript.
I am trying to call a web service that returns a pdf file in this format :
In order to call the pdf i am using res.body just like the code below :
var url="https://........../......./..../..";
var options = {
"rejectUnauthorized": false,
"method": "GET",
"url": url,
"headers": {
"Authorization": "Basic EJFHUygdiAISDGIF",
"Content-Type": "application/json"
}
};
request(options, (err, res) => {
if (res.statusCode == 200 ) {
conversation.logger().info("pdf:" + res.body); // in order to check the content of the pdf in the platform i use
}
});
My problem here is that i dont know how to download or display the pdf content .
Any help would be valuable.
Change content type to pdf
"headers": {
"Authorization": "Basic EJFHUygdiAISDGIF",
"Content-Type": "application/pdf"
}