Commit a562351e authored by Aaron Jacobs's avatar Aaron Jacobs Committed by Brad Fitzpatrick

net/http: clarify Request.ContentLength behavior on the client.

While you could argue the previous wording technically said that -1 is
an acceptable way to indicate "unknown" on the client, it could be read
as ambiguous. Now it's clear that both 0 and -1 mean unknown.

Change-Id: I3bc5a3fd5afd1999e487296ec121eb548415e6b0
Reviewed-on: https://go-review.googlesource.com/29130Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 6488201b
...@@ -153,7 +153,8 @@ type Request struct { ...@@ -153,7 +153,8 @@ type Request struct {
// The value -1 indicates that the length is unknown. // The value -1 indicates that the length is unknown.
// Values >= 0 indicate that the given number of bytes may // Values >= 0 indicate that the given number of bytes may
// be read from Body. // be read from Body.
// For client requests, a value of 0 means unknown if Body is not nil. // For client requests, a value of 0 with a non-nil Body is
// also treated as unknown.
ContentLength int64 ContentLength int64
// TransferEncoding lists the transfer encodings from outermost to // TransferEncoding lists the transfer encodings from outermost to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment