0
I’m using Request to download a billet from https://www.boletocloud.com/ which is in pdf. Turns out I can’t see the pdf I downloaded, the API developers say it’s in UTF-8, I’ve uploaded everything but it still doesn’t 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);
});
Put the solution in a reply please, we are not a forum, understand the operation of the site: http://answall.com/tour
– Guilherme Nascimento
I would put as a response, however I understood that the recommendations was to respond. Anyway I will change here.
– Marcelo Junior