Problem Context: There is an external webservice, which is not part of the domain of my application, which, when accessed directly via browser, takes the user to a loading web page that handles the request according to the parameters passed in the url and later returns a .pdf file directly in the browser view.
I'm working on an application that aims to make a call to that particular webservice and return a .pdf file generated by it to the user.
In order to try to get the file generated by webservice, I tried to use the request package of npm as follows:
var request= Meteor.npmRequire('request');
request.get({
url: this_nfse.link_nfse, timeout: 1500, jar: true, encoding: 'binary'
}
, Meteor.bindEnvironment(function( error, response, body ){
if(!error && response)
{
//tratar resultado de acordo com o objetivo da aplicação
}
}));
But what I get in the body object is the html page that requests the generation of the .pdf file to the webservice, not the file or representation of that itself.
Note: I tried to use the native HTTP package from the meteor, but I got the same result.
Any help or tip will be very welcome, thank you.