Google Drive REST API分段上传。 400:内容类型不正确。请使用multipart

问题描述 投票:0回答:1

我正在尝试使用REST API将文件上传到Google云端硬盘,如此处所写的带有POST请求的多部分上传:qazxsw poi。

尝试使用高级REST客户端,如文档中的示例。但是对于Content-Type“multipart / related”,我得到了一个错误:

https://developers.google.com/drive/api/v3/multipart-upload

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

400: Bad content type.  Please use multipart.

仍然尝试了多部分的所有子类型(例如,multipart / mixed,...)但总是得到错误400。

这里提到了类似的错误:Media type 'multipart' is not supported. Valid media types: [*/*] ,但没有文档中所写的“multipart / related”。

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

谢谢你,最好!

post request google-drive-sdk
1个回答
0
投票

经过大量的反复试验后,我发现了问题:我将error: Bad content type. Please use multipart作为单个标题参数,但应该像boundary一样添加到Content-Type。现在它的工作正确!

© www.soinside.com 2019 - 2024. All rights reserved.