diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-01-17 12:40:45 +0100 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-01-17 12:40:45 +0100 |
commit | 3e45412327a2654a77944249962b3652e6142299 (patch) | |
tree | bc3bf69452afa055423cbe0c5cfa8ca357df6ccf /src/pkg/http/response_test.go | |
parent | c533680039762cacbc37db8dc7eed074c3e497be (diff) | |
download | golang-upstream/2011.01.12.tar.gz |
Imported Upstream version 2011.01.12upstream/2011.01.12
Diffstat (limited to 'src/pkg/http/response_test.go')
-rw-r--r-- | src/pkg/http/response_test.go | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/src/pkg/http/response_test.go b/src/pkg/http/response_test.go index 889b770be..89a8c3b44 100644 --- a/src/pkg/http/response_test.go +++ b/src/pkg/http/response_test.go @@ -21,7 +21,7 @@ type respTest struct { var respTests = []respTest{ // Unchunked response without Content-Length. - respTest{ + { "HTTP/1.0 200 OK\r\n" + "Connection: close\r\n" + "\r\n" + @@ -45,7 +45,7 @@ var respTests = []respTest{ }, // Unchunked response with Content-Length. - respTest{ + { "HTTP/1.0 200 OK\r\n" + "Content-Length: 10\r\n" + "Connection: close\r\n" + @@ -71,7 +71,7 @@ var respTests = []respTest{ }, // Chunked response without Content-Length. - respTest{ + { "HTTP/1.0 200 OK\r\n" + "Transfer-Encoding: chunked\r\n" + "\r\n" + @@ -97,7 +97,7 @@ var respTests = []respTest{ }, // Chunked response with Content-Length. - respTest{ + { "HTTP/1.0 200 OK\r\n" + "Transfer-Encoding: chunked\r\n" + "Content-Length: 10\r\n" + @@ -122,6 +122,44 @@ var respTests = []respTest{ "Body here\n", }, + + // Status line without a Reason-Phrase, but trailing space. + // (permitted by RFC 2616) + { + "HTTP/1.0 303 \r\n\r\n", + Response{ + Status: "303 ", + StatusCode: 303, + Proto: "HTTP/1.0", + ProtoMajor: 1, + ProtoMinor: 0, + RequestMethod: "GET", + Header: map[string]string{}, + Close: true, + ContentLength: -1, + }, + + "", + }, + + // Status line without a Reason-Phrase, and no trailing space. + // (not permitted by RFC 2616, but we'll accept it anyway) + { + "HTTP/1.0 303\r\n\r\n", + Response{ + Status: "303 ", + StatusCode: 303, + Proto: "HTTP/1.0", + ProtoMajor: 1, + ProtoMinor: 0, + RequestMethod: "GET", + Header: map[string]string{}, + Close: true, + ContentLength: -1, + }, + + "", + }, } func TestReadResponse(t *testing.T) { |