Does anyone know how to read or get access to the attachement of an HTTP response?
I mean, the server response is:
HTTP/1.1 200 OK
Server: something
Date: Fri, 01 May 2015 10:22:29 GMT
Content-Type: application/pdf
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Language, Cookie
X-Frame-Options: SAMEORIGIN
Content-Language: en
Content-Disposition: attachment; filename=mybill-234324.pdf
Set-Cookie: s=xxxxx; expires=Fri, 15-May-2015 10:22:29 GMT; httponly; Max-Age=1209600; Path=/; secure
Strict-Transport-Security: max-age=15552000
But where is this mybill-234324.pdf file content???
My code:
var req = https.request({
method: 'GET',
host: 'thehost.ext',
path: '/account/bills/' + number + '/',
headers: {
'Cookie': 's=supercryptedhash;',
'Accept-Language': 'en-US,en'
}
}, function(res) {
// ????
});
req.on('error', function(err) {
console.error('Request Error', err);
});
req.end();