在我的情况下,我必须在服务器端启用与CORS相关的功能:
Access-Control-Expose-Headers: Content-Disposition
这使得浏览器端的JavaScript可以读取此标头。
在服务器端使用node.js + express + cors的情况下,它可能如下所示:
app.use(cors({
origin: 'http://localhost:8080',
credentials: true,
exposedHeaders: ['Content-Disposition']
}))
所以我可以在 Axios 返回的头文件中看到 "content-disposition"。