yutakahirano / fetch-with-streams

Fetch API integrated with Streams.
66 stars 8 forks source link

Uploading: Provide a way to not set Content-Length #65

Closed yutakahirano closed 7 years ago

yutakahirano commented 7 years ago

The current spec says:

  1. Let contentLengthValue be null.
  2. If httpRequest's body is null and httpRequest's method is POST or PUT, then set contentLengthValue to 0.
  3. If httpRequest's body is non-null, set contentLengthValue to httpRequest's body's total bytes, utf-8 encoded.
  4. If contentLengthValue is non-null, append Content-Length/contentLengthValue to httpRequest's header list.

We should not append a Content-Length header when uploading a Request made with a ReadableStream.

annevk commented 7 years ago

We should probably annotate body in some way. Either it's known-length (everything we do today) or unknown (streams).

wanderview commented 7 years ago

We should probably annotate body in some way. Either it's known-length (everything we do today) or unknown (streams).

FWIW, this matches exactly what we have to do at the implementation level. So sounds good to me.