【发布时间】:2021-10-05 01:12:37
【问题描述】:
因此,在我的代码中,我已将内容类型设置为被上传的任何内容替换,但 Azure 一直使用默认的 application/octet-stream 覆盖它。我可以在网络选项卡中看到内容类型是 image/png 并且在通过 http 的 axios 请求中,在配置标头中它已设置为内容类型,但是当进入容器查看文件时,它是应用程序/八位字节流。
请注意,我使用的是 npm 包 vue-azure-blob-upload
http.put(uri, requestData,
{
headers: {
'x-ms-blob-type': 'BlockBlob',
'Content-Type': state.file.type,
'x-ms-version': '2020-10-02',
'x-ms-date': new Date(),
},
transformRequest: [],
}).then(function (response) {
$log(response);
}
在 http.js 中:
init() {
axios.defaults.headers.put['Content-Type'] = 'image/png';
},
【问题讨论】:
-
请尝试将请求中的
Content-Type标头更改为x-ms-content-type。 -
@GauravMantri 我试过它不起作用,但通过添加 blob 使其变为
x-ms-blob-content-type它起作用了,所以感谢您朝着正确的方向推动! -
对不起...我的错!是的,它是
x-ms-blob-content-type。
标签: azure npm azure-blob-storage