Skip to content

Commit a562351

Browse files
jacobsabradfitz
authored andcommitted
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/29130 Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 6488201 commit a562351

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/net/http/request.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ type Request struct {
153153
// The value -1 indicates that the length is unknown.
154154
// Values >= 0 indicate that the given number of bytes may
155155
// be read from Body.
156-
// For client requests, a value of 0 means unknown if Body is not nil.
156+
// For client requests, a value of 0 with a non-nil Body is
157+
// also treated as unknown.
157158
ContentLength int64
158159

159160
// TransferEncoding lists the transfer encodings from outermost to

0 commit comments

Comments
 (0)