Skip to content

Commit

Permalink
test: close response body (#1496)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear authored Feb 15, 2023
1 parent 9230a3d commit b79a03a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
version: v1.51.1
args: --enable=nolintlint --enable=gochecknoinits --verbose
args: --enable=nolintlint,gochecknoinits,bodyclose --verbose
1 change: 1 addition & 0 deletions fasthttputil/inmemory_listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ func testInmemoryListenerHTTPSingle(t *testing.T, client *http.Client, content s
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
defer func() { _ = res.Body.Close() }()
b, err := io.ReadAll(res.Body)
if err != nil {
t.Fatalf("unexpected error: %v", err)
Expand Down
1 change: 1 addition & 0 deletions header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func TestResponseHeaderMultiLineValue(t *testing.T) {
if err != nil {
t.Fatalf("parse response using net/http failed, %v", err)
}
defer func() { _ = response.Body.Close() }()

if !bytes.Equal(header.StatusMessage(), []byte("SuperOK")) {
t.Errorf("parse status line with non-default value failed, got: '%q' want: 'SuperOK'", header.StatusMessage())
Expand Down

0 comments on commit b79a03a

Please sign in to comment.