Skip to content

Commit 702a4a4

Browse files
authored
Merge pull request #786 from vincepri/fix-body-leak
🐛 Integration test should close http body
2 parents 82a78f9 + 6a43798 commit 702a4a4

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

hack/verify.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ golangci-lint run --disable-all \
4242
--enable=lll \
4343
--enable=dupl \
4444
--enable=goimports \
45+
--enable=bodyclose \
4546
./pkg/... ./examples/... .
4647

4748
# TODO: Enable these as we fix them to make them pass

pkg/internal/testing/integration/internal/process.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,12 @@ func pollURLUntilOK(url url.URL, interval time.Duration, ready chan bool, stopCh
170170
}
171171
for {
172172
res, err := http.Get(url.String())
173-
if err == nil && res.StatusCode == http.StatusOK {
174-
ready <- true
175-
return
173+
if err == nil {
174+
res.Body.Close()
175+
if res.StatusCode == http.StatusOK {
176+
ready <- true
177+
return
178+
}
176179
}
177180

178181
select {

0 commit comments

Comments
 (0)