aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/http/requestwrite_test.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-02-24 15:13:39 -0800
committerRuss Cox <rsc@golang.org>2010-02-24 15:13:39 -0800
commit37666561b2f040c965aa8d635453f2e58839e7bc (patch)
treed7b3cca6623b7bf751bf918ed65cf7776b27fd4c /src/pkg/http/requestwrite_test.go
parent1be05bbe1e8bf20442b78401bc73001e33ea9979 (diff)
downloadgo-37666561b2f040c965aa8d635453f2e58839e7bc.tar.xz
http: fix handling of Close, use Close in http.Post
default to HTTP/1.1 R=petar-m CC=golang-dev https://golang.org/cl/224041
Diffstat (limited to 'src/pkg/http/requestwrite_test.go')
-rw-r--r--src/pkg/http/requestwrite_test.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/pkg/http/requestwrite_test.go b/src/pkg/http/requestwrite_test.go
index 2b47e0b3b1..f39e8a86d5 100644
--- a/src/pkg/http/requestwrite_test.go
+++ b/src/pkg/http/requestwrite_test.go
@@ -82,6 +82,43 @@ var reqWriteTests = []reqWriteTest{
"Transfer-Encoding: chunked\r\n\r\n" +
"6\r\nabcdef\r\n0\r\n\r\n",
},
+ // HTTP/1.1 POST => chunked coding; body; empty trailer
+ reqWriteTest{
+ Request{
+ Method: "POST",
+ URL: &URL{
+ Scheme: "http",
+ Host: "www.google.com",
+ Path: "/search",
+ },
+ ProtoMajor: 1,
+ ProtoMinor: 1,
+ Header: map[string]string{},
+ Close: true,
+ Body: nopCloser{bytes.NewBufferString("abcdef")},
+ TransferEncoding: []string{"chunked"},
+ },
+
+ "POST /search HTTP/1.1\r\n" +
+ "Host: www.google.com\r\n" +
+ "User-Agent: Go http package\r\n" +
+ "Connection: close\r\n" +
+ "Transfer-Encoding: chunked\r\n\r\n" +
+ "6\r\nabcdef\r\n0\r\n\r\n",
+ },
+ // default to HTTP/1.1
+ reqWriteTest{
+ Request{
+ Method: "GET",
+ RawURL: "/search",
+ Host: "www.google.com",
+ },
+
+ "GET /search HTTP/1.1\r\n" +
+ "Host: www.google.com\r\n" +
+ "User-Agent: Go http package\r\n" +
+ "\r\n",
+ },
}
func TestRequestWrite(t *testing.T) {