aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/request_test.go
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2016-10-22 09:47:05 -0700
committerBrad Fitzpatrick <bradfitz@golang.org>2016-10-22 19:44:53 +0000
commitb992c391d4aae64e147fc64c77ad41d61be8e2e7 (patch)
treed29aba00374f9496d639f9b5e259aca14d9d734e /src/net/http/request_test.go
parent448e1db103df7a9b29aa360f42fdcdc9b89fa399 (diff)
downloadgo-b992c391d4aae64e147fc64c77ad41d61be8e2e7.tar.xz
net/http: add NoBody, don't return nil from NewRequest on zero bodies
This is an alternate solution to https://golang.org/cl/31445 Instead of making NewRequest return a request with Request.Body == nil to signal a zero byte body, add a well-known variable that means explicitly zero. Too many tests inside Google (and presumably the outside world) broke. Change-Id: I78f6ecca8e8aa1e12179c234ccfb6bcf0ee29ba8 Reviewed-on: https://go-review.googlesource.com/31726 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Diffstat (limited to 'src/net/http/request_test.go')
-rw-r--r--src/net/http/request_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/net/http/request_test.go b/src/net/http/request_test.go
index e463d79492..3c965c1e8a 100644
--- a/src/net/http/request_test.go
+++ b/src/net/http/request_test.go
@@ -511,7 +511,7 @@ func TestNewRequestContentLength(t *testing.T) {
if req.ContentLength != tt.want {
t.Errorf("test[%d]: ContentLength(%T) = %d; want %d", i, tt.r, req.ContentLength, tt.want)
}
- if (req.ContentLength == 0) != (req.Body == nil) {
+ if (req.ContentLength == 0) != (req.Body == NoBody) {
t.Errorf("test[%d]: ContentLength = %d but Body non-nil is %v", i, req.ContentLength, req.Body != nil)
}
}