发送到 Azure Blob 容器时内容类型被覆盖

Content Type being overwritten when sending to Azure Blob container

因此,在我的代码中,我已将内容类型设置为由正在上传的任何内容替换,但 Azure 一直使用默认值 application/octet-stream 覆盖它。我可以在网络选项卡中看到 content-type 是 image/png 并且在通过 http 的 axios 请求中,在配置 header 中它被设置为内容类型但是当进入查看文件的容器,它是 application/octet-stream.

请注意,我使用的是 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';
},

谢谢Gaurav Mantri。添加您的评论部分建议以帮助其他社区成员。

Change the content-type header in the request from state.file.type to x-ms-blob-content-type