有人知道如何读取或访问HTTP响应的附件吗?
我的意思是,服务器响应是:
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
但是这个mybill-234324.pdf文件的内容在哪里呢?
我的代码:
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();