Skip to content

Commit 97b0415

Browse files
committed
net/http: update test to check Content-Length 0 Body more reliably
The way to send an explicitly-zero Content-Length is to set a nil Body. Fix this test to do that, rather than relying on type sniffing. Updates #17480 Updates #17071 Change-Id: I6a38e20f17013c88ec4ea69d73c507e4ed886947 Reviewed-on: https://go-review.googlesource.com/31434 TryBot-Result: Gobot Gobot <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]> Reviewed-by: Chris Broadfoot <[email protected]>
1 parent 75fef5a commit 97b0415

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/net/http/clientserver_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ func TestH12_RequestContentLength_Known_NonZero(t *testing.T) {
468468
}
469469

470470
func TestH12_RequestContentLength_Known_Zero(t *testing.T) {
471-
h12requestContentLength(t, func() io.Reader { return strings.NewReader("") }, 0)
471+
h12requestContentLength(t, func() io.Reader { return nil }, 0)
472472
}
473473

474474
func TestH12_RequestContentLength_Unknown(t *testing.T) {

0 commit comments

Comments
 (0)