Closed Dror-Bar closed 6 years ago
I have managed to get what I need using binary: true and encoding library:
httpntlm.get({
url: url,
username: username,
password: password,
domain: domain,
binary: true
},
function (err, res) {
if (err) { console.log(err); return; }
const decodedBody = encoding.convert(res.body, 'UTF-8', 'CP1255');
console.log(decodedBody);
});
Hi, I'm trying to get a response from a server with incorrect encoding. For that I need to decode a buffer of the response before it becomes an (incorrectly) utf8 encoded string. is it possible to use res.on() with this with this library? for example:
If I try this:
I get an error 'res.on() is not a function'. Is there any solution? or any other way to get the response as a buffer?