Browse code

integration-cli: fix duplicate close of body

request.ReadBody already closes the body;

time="2025-03-20T19:08:25Z" level=error msg="subsequent attempt to close ReadCloserWrapper"

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2025/03/21 04:16:12
Showing 2 changed files
... ...
@@ -122,7 +122,6 @@ RUN echo 'right'
122 122
 	assert.NilError(c, err)
123 123
 	assert.Equal(c, res.StatusCode, http.StatusOK)
124 124
 
125
-	defer body.Close()
126 125
 	content, err := request.ReadBody(body)
127 126
 	assert.NilError(c, err)
128 127
 
... ...
@@ -59,7 +59,6 @@ func (s *DockerAPISuite) TestAPIClientVersionOldNotSupported(c *testing.T) {
59 59
 
60 60
 	resp, body, err := request.Get(testutil.GetContext(c), "/v"+version+"/version")
61 61
 	assert.NilError(c, err)
62
-	defer body.Close()
63 62
 	assert.Equal(c, resp.StatusCode, http.StatusBadRequest)
64 63
 	expected := fmt.Sprintf("client version %s is too old. Minimum supported API version is %s, please upgrade your client to a newer version", version, testEnv.DaemonVersion.MinAPIVersion)
65 64
 	b, err := request.ReadBody(body)