Google Drive API 400分块文件上传错误请求

Google Drive API 400 Bad Request on chunked file upload

本文关键字:错误 请求 文件 Drive API 400分 Google      更新时间:2023-09-26

严格遵循谷歌教程(谷歌驱动器可恢复上传)。初始POST请求成功。通过该请求,我发送了一些元数据(文件标题),得到了一个带有Location标头的响应,其中包含upload_id参数。我保存了那个uri,然后开始我的分块上传过程。

我将从Chrome的开发者工具网络选项卡发布请求,这应该会揭示我可能错过的任何内容。

Remote Address:xxx.xxx.xx.x:443
Request URL:https://www.googleapis.com/upload/drive/v2/files?uploadType=resumable&upload_id=AEn...
Request Method:PUT
Status Code:400 Bad Request
Request Headers
:host:www.googleapis.com
:method:PUT
:path:/upload/drive/v2/files?uploadType=resumable&upload_id=AEn...
:scheme:https
:version:HTTP/1.1
accept:*//*
accept-encoding:gzip,deflate
accept-language:en-US,en;q=0.8,et;q=0.6,ja;q=0.4,ru;q=0.2,de;q=0.2
authorization:Bearer ya29...
cache-control:no-cache
content-length:204800
content-range:bytes 0-204799/9623941
content-type:application/x-msdownload
origin:http://localhost:8080
pragma:no-cache
referer:http://localhost:8080/index.html
user-agent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
x-client-data:CI62yQEIprbJAQiptskBCMS2yQEInobKAQi4iMoBCPGIygE=
Query String Parameters
uploadType:resumable
upload_id:AEn...
Response Headers
access-control-allow-origin:http://localhost:8080
access-control-expose-headers:Content-Length, Content-Type, Date, Server, Transfer-Encoding
alternate-protocol:443:quic,p=0.01
content-length:193
content-type:application/json; charset=UTF-8
date:Sun, 28 Sep 2014 17:50:48 GMT
server:UploadServer ("Built on Sep 18 2014 17:00:06 (1411084806)")
status:400 Bad Request
vary:Origin
version:HTTP/1.1

忽略accept标头中的第二个斜杠。

这是我开始第一次上传区块后得到的响应。根据谷歌的参考,一切似乎都是正确的,但它不起作用。

我没有使用谷歌的client.js库。使用普通的旧XMLhttpRequest()

我这边一切都很好。我的请求是正确的,但昨天(2014年9月28日)谷歌服务似乎出现了问题。现在一切都很好。