@@ -2021,25 +2021,27 @@ func TestResponseReadWithoutBody(t *testing.T) {
20212021 var resp Response
20222022
20232023 testResponseReadWithoutBody (t , & resp , "HTTP/1.1 304 Not Modified\r \n Content-Type: aa\r \n Content-Length: 1235\r \n \r \n " , false ,
2024- 304 , 1235 , "aa" , nil )
2024+ 304 , 1235 , "aa" )
20252025
2026- testResponseReadWithoutBody (t , & resp , "HTTP/1.1 204 Foo Bar\r \n Content-Type: aab\r \n Transfer-Encoding: chunked\r \n \r \n 0\r \n Foo: bar \r \ n\r \n " , false ,
2027- 204 , - 1 , "aab" , map [ string ] string { "Foo" : "bar" } )
2026+ testResponseReadWithoutBody (t , & resp , "HTTP/1.1 204 Foo Bar\r \n Content-Type: aab\r \n Transfer-Encoding: chunked\r \n \r \n 0\r \n \r \n " , false ,
2027+ 204 , - 1 , "aab" )
20282028
20292029 testResponseReadWithoutBody (t , & resp , "HTTP/1.1 123 AAA\r \n Content-Type: xxx\r \n Content-Length: 3434\r \n \r \n " , false ,
2030- 123 , 3434 , "xxx" , nil )
2030+ 123 , 3434 , "xxx" )
20312031
20322032 testResponseReadWithoutBody (t , & resp , "HTTP 200 OK\r \n Content-Type: text/xml\r \n Content-Length: 123\r \n \r \n foobar\r \n " , true ,
2033- 200 , 123 , "text/xml" , nil )
2033+ 200 , 123 , "text/xml" )
20342034
20352035 // '100 Continue' must be skipped.
20362036 testResponseReadWithoutBody (t , & resp , "HTTP/1.1 100 Continue\r \n Foo-bar: baz\r \n \r \n HTTP/1.1 329 aaa\r \n Content-Type: qwe\r \n Content-Length: 894\r \n \r \n " , true ,
2037- 329 , 894 , "qwe" , nil )
2037+ 329 , 894 , "qwe" )
20382038}
20392039
20402040func testResponseReadWithoutBody (t * testing.T , resp * Response , s string , skipBody bool ,
2041- expectedStatusCode , expectedContentLength int , expectedContentType string , expectedTrailer map [ string ] string ,
2041+ expectedStatusCode , expectedContentLength int , expectedContentType string ,
20422042) {
2043+ t .Helper ()
2044+
20432045 r := bytes .NewBufferString (s )
20442046 rb := bufio .NewReader (r )
20452047 resp .SkipBody = skipBody
@@ -2051,7 +2053,6 @@ func testResponseReadWithoutBody(t *testing.T, resp *Response, s string, skipBod
20512053 t .Fatalf ("Unexpected response body %q. Expected %q. response=%q" , resp .Body (), "" , s )
20522054 }
20532055 verifyResponseHeader (t , & resp .Header , expectedStatusCode , expectedContentLength , expectedContentType , "" )
2054- verifyResponseTrailer (t , & resp .Header , expectedTrailer )
20552056
20562057 // verify that ordinal response is read after null-body response
20572058 resp .SkipBody = false
0 commit comments