aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/http/readrequest_test.go
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2011-06-24 13:48:12 -0700
committerBrad Fitzpatrick <bradfitz@golang.org>2011-06-24 13:48:12 -0700
commite16b74075f49d4bd42d30edb7f7081ea359f364e (patch)
tree7667ee23448b37b3d65f52c51693d4d38872432e /src/pkg/http/readrequest_test.go
parente0e28d2b9323e136be0ff28fbabcdd918d53a691 (diff)
downloadgo-e16b74075f49d4bd42d30edb7f7081ea359f364e.tar.xz
http: assume ContentLength 0 on GET requests
Incremental step in fix for issue 1999 R=golang-dev, kevlar CC=golang-dev https://golang.org/cl/4667041
Diffstat (limited to 'src/pkg/http/readrequest_test.go')
-rw-r--r--src/pkg/http/readrequest_test.go27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/pkg/http/readrequest_test.go b/src/pkg/http/readrequest_test.go
index 0b92b79426..0df6d21a84 100644
--- a/src/pkg/http/readrequest_test.go
+++ b/src/pkg/http/readrequest_test.go
@@ -69,6 +69,31 @@ var reqTests = []reqTest{
"abcdef\n",
},
+ // GET request with no body (the normal case)
+ {
+ "GET / HTTP/1.1\r\n" +
+ "Host: foo.com\r\n\r\n",
+
+ Request{
+ Method: "GET",
+ RawURL: "/",
+ URL: &URL{
+ Raw: "/",
+ Path: "/",
+ RawPath: "/",
+ },
+ Proto: "HTTP/1.1",
+ ProtoMajor: 1,
+ ProtoMinor: 1,
+ Close: false,
+ ContentLength: 0,
+ Host: "foo.com",
+ Form: Values{},
+ },
+
+ "",
+ },
+
// Tests that we don't parse a path that looks like a
// scheme-relative URI as a scheme-relative URI.
{
@@ -94,7 +119,7 @@ var reqTests = []reqTest{
ProtoMinor: 1,
Header: Header{},
Close: false,
- ContentLength: -1,
+ ContentLength: 0,
Host: "test",
Form: Values{},
},