Note that there are some explanatory texts on larger screens.

plurals
  1. POREST Upload to Skydrive without Content-Length
    text
    copied!<p>I'm trying to upload a file to Skydrive where I don't a-priori know the Content-Length. With other storage services I can do this with chunked HTTP upload, but Skydrive always complains about Content-Length being invalid.</p> <p>Here are the full headers I'm sending:</p> <pre><code>PUT /v5.0/me/skydrive/files/skydrive_test.js?overwrite=ChooseNewName HTTP/1.1 Authorization: Bearer &lt;TOKEN_REDACTED&gt; host: apis.live.net content-type: application/javascript Connection: keep-alive Transfer-Encoding: chunked </code></pre> <p>Here's the response I get back:</p> <pre><code>cache-control: private, no-cache, no-store, must-revalidate transfer-encoding: chunked content-type: application/json; charset=UTF-8 server: Live-API/16.4.1731.327 Microsoft-HTTPAPI/2.0 x-content-type-options: nosniff x-http-live-request-id: API.c6afda25-2d9f-4248-9f49-001ccb3a9007 x-http-live-server: BAYMSG1010836 date: Wed, 15 May 2013 14:33:00 GMT { "error": { "code": "request_invalid_content_length", "message": "The value for the Content-Length header isn't valid." }} </code></pre> <p>Is there any way I can do this without setting Content-Length (i.e. using chunked encoding)?</p> <p>I'm using node.js to do this, but it should apply equally with any language using the REST API, hence I haven't tagged this with a particular language.</p> <p>For example Dropbox offers the Chunked Upload command: <a href="https://www.dropbox.com/developers/core/docs#chunked-upload" rel="nofollow">https://www.dropbox.com/developers/core/docs#chunked-upload</a></p> <p>And Google Drive, even though it says it wants Content-Length, doesn't need it for it's resumable upload API: <a href="https://developers.google.com/drive/manage-uploads#resumable" rel="nofollow">https://developers.google.com/drive/manage-uploads#resumable</a></p> <p>Is there an API I'm missing?</p> <p><strong>Edit:</strong> Things I've tried: Setting Content-Length: 0 results in it working, but the file is zero bytes. Setting Content-length:0 and Transfer-Encoding: chunked, results in the original error above.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload