26
27
Request: dummyReq("GET"),
28
Body: ioutil.NopCloser(bytes.NewBufferString("abcdef")),
29
Body: ioutil.NopCloser(strings.NewReader("abcdef")),
42
43
Request: dummyReq("GET"),
44
Body: ioutil.NopCloser(bytes.NewBufferString("abcdef")),
45
Body: ioutil.NopCloser(strings.NewReader("abcdef")),
47
48
"HTTP/1.0 200 OK\r\n" +
52
// HTTP/1.1 response with unknown length and Connection: close
58
Request: dummyReq("GET"),
60
Body: ioutil.NopCloser(strings.NewReader("abcdef")),
64
"HTTP/1.1 200 OK\r\n" +
65
"Connection: close\r\n" +
69
// HTTP/1.1 response with unknown length and not setting connection: close
75
Request: dummyReq11("GET"),
77
Body: ioutil.NopCloser(strings.NewReader("abcdef")),
81
"HTTP/1.1 200 OK\r\n" +
82
"Connection: close\r\n" +
86
// HTTP/1.1 response with unknown length and not setting connection: close, but
93
Request: dummyReq11("GET"),
95
Body: ioutil.NopCloser(strings.NewReader("abcdef")),
97
TransferEncoding: []string{"chunked"},
100
"HTTP/1.1 200 OK\r\n" +
101
"Transfer-Encoding: chunked\r\n\r\n" +
102
"6\r\nabcdef\r\n0\r\n\r\n",
104
// HTTP/1.1 response 0 content-length, and nil body
110
Request: dummyReq11("GET"),
116
"HTTP/1.1 200 OK\r\n" +
117
"Content-Length: 0\r\n" +
120
// HTTP/1.1 response 0 content-length, and non-nil empty body
126
Request: dummyReq11("GET"),
128
Body: ioutil.NopCloser(strings.NewReader("")),
132
"HTTP/1.1 200 OK\r\n" +
133
"Content-Length: 0\r\n" +
136
// HTTP/1.1 response 0 content-length, and non-nil non-empty body
142
Request: dummyReq11("GET"),
144
Body: ioutil.NopCloser(strings.NewReader("foo")),
148
"HTTP/1.1 200 OK\r\n" +
149
"Connection: close\r\n" +
51
152
// HTTP/1.1, chunked coding; empty trailer; close
57
158
Request: dummyReq("GET"),
59
Body: ioutil.NopCloser(bytes.NewBufferString("abcdef")),
160
Body: ioutil.NopCloser(strings.NewReader("abcdef")),
61
162
TransferEncoding: []string{"chunked"},
90
191
"Foo: Bar Baz\r\n" +
195
// Want a single Content-Length header. Fixing issue 8180 where
199
StatusCode: StatusOK,
202
Request: &Request{Method: "POST"},
205
TransferEncoding: nil,
208
"HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n",
95
212
for i := range respWriteTests {