请问获取到对方接口返回的headers,怎么通过写代码取到其中的filename呢?
console.log("headers: ", resHttps.headers);
得到的结果如下: headers: { server: ‘nginx/0.7.64’, date: ‘Tue, 17 Jul 2012 06:30:58 GMT’, ‘content-type’: ‘images/jpg; charset=utf-8’, connection: ‘keep-alive’, ‘content-length’: ‘41013’, ‘content-disposition’: ‘attachment; filename=“23970002402972637061382188.jpg”’ }
怎么写js获取到filename,高手帮忙解答下啊,hoho。
6 回复
请明示。截取filename后面的值?
3Q~
@xuhaijinsky2008 resHttps.headers[‘content-disposition’].split(’"’)[1]
@HelloWhat 果然犀利,瞬间获取到了,呵呵。