From a562351e512682046623ecbd106f4973f3525be9 Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Wed, 14 Sep 2016 12:57:15 +1000 Subject: [PATCH] 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 --- src/net/http/request.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/net/http/request.go b/src/net/http/request.go index 16e7009424..bebf55ccc4 100644 --- a/src/net/http/request.go +++ b/src/net/http/request.go @@ -153,7 +153,8 @@ type Request struct { // The value -1 indicates that the length is unknown. // Values >= 0 indicate that the given number of bytes may // 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 // TransferEncoding lists the transfer encodings from outermost to -- 2.48.1