【问题标题】:GoogleDrive REST API multipart upload. 400: Bad content type. Please use multipartGoogle Drive REST API 分段上传。 400:错误的内容类型。请使用多部分
【发布时间】:2019-02-25 00:16:46
【问题描述】:

我正在尝试使用此处编写的 REST API 将文件上传到 GoogleDrive,作为带有 POST 请求的分段上传: https://developers.google.com/drive/api/v3/multipart-upload.

尝试像文档中的示例一样使用高级 REST 客户端。但是使用 Content-Type "multipart/related" 我得到了一个错误:

400: Bad content type.  Please use multipart.

当我只使用“multipart”作为 Content-Type 时:

Media type 'multipart' is not supported. Valid media types: [*/*]

仍然尝试了 multipart 的所有子类型(例如 multipart/mixed,...),但总是出现错误 400。

这里提到了类似的错误:error: Bad content type. Please use multipart,但不是文档中所写的“multipart/related”。

知道如何解决这个问题吗?

谢谢你,最好的!

【问题讨论】:

    标签: post request google-drive-api


    【解决方案1】:

    经过大量试验和错误后,我发现了问题:我将boundary 作为单个标头参数,但应该像multipart/related; boundary=boundary53170215682661314146 一样添加到Content-Type。现在它可以正常工作了!

    【讨论】:

      猜你喜欢
      • 2020-10-04
      • 2018-02-13
      • 2015-09-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-23
      • 2017-02-11
      • 1970-01-01
      相关资源
      最近更新 更多