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

时间:2014-09-28 18:12:43

标签: javascript google-drive-api

遵循严格的谷歌教程(google drive resumable upload)。 初始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

忽略接受标题中的第二个斜杠。

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

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

1 个答案:

答案 0 :(得分:0)

我身边的一切都很好。我的要求是正确的,但昨天谷歌服务似乎有问题(28.09.2014)。现在一切都很好。