【发布时间】:2019-10-07 19:13:42
【问题描述】:
我在 IBM Cloud Functions 中部署了一个无服务器函数。该函数生成并下载一个excel文件。
在本地它按预期工作,但在部署的版本上我收到以下错误:
{
"code": "xxxxxxxxxx",
"error": "Response type in header did not match generated content type."
}
使用 Content-Type 标头 'application/json' 我可以发送 json 和 'image/png' 甚至图像作为 base64。 Zip 文件不起作用。我试过'Content-Type': 'application/zip和'Content-Type': 'application/zip, application/octet-stream
我需要做更多的配置吗?
完整示例:
headers: {
'Content-Type': 'application/zip',
'Content-Disposition': `attachment; filename=foo.zip;`,
'Content-Transfer-Encoding': 'binary',
'Content-Length': zip.length
},
【问题讨论】:
标签: node.js zip ibm-cloud mime-types serverless-framework