I am using the Request to download a link ticket that is in pdf. It turns out that I can not see the pdf that I downloaded, the API developers say that it is in UTF-8, I've set it all but it still does not work.
request
app.get('/', function(req, res) {
var options = { method: 'POST',
url: 'https://sandbox.boletocloud.com/api/v1/boletos',
headers:
{ 'content-type': 'application/x-www-form-urlencoded;',
'postman-token': '058e9f74-644b-a03c-fc53-fbc46f3fe8b3',
'cache-control': 'no-cache',
'accept-charset': 'UTF-8',
encoding: 'utf-8',
authorization: 'Basic YXBpLWtleV9yODBfLVUyWHlWcjlsbFIwSXhMOUFGUkFRTnloUU11UF9SUnRZTmU1WnNjPTp0b2tlbg==' },
form:
{ 'boleto.conta.banco': /* Outros campos... */ } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
res.contentType("application/pdf; charset=utf-8");
var utf8 = body.toString('utf8');
res.send(utf8);
});