Skip to content

Commit

Permalink
Merge pull request #1 from pinealctx/subsp
Browse files Browse the repository at this point in the history
add explicit close response body function.
  • Loading branch information
xpineal authored Nov 28, 2023
2 parents 6e729de + d3cd5ff commit 7c8ba81
Show file tree
Hide file tree
Showing 5 changed files with 1,437 additions and 66 deletions.
2 changes: 0 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,11 @@ linters-settings:
linters:
disable-all: true
enable:
- deadcode
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- stylecheck
- typecheck
- unused
Expand Down
3 changes: 3 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,13 @@ func (c *Client) Do(ctx context.Context, req IRequest) (IResponse, error) {
request.Header.Set(headerUserAgent, defaultUA)
}
var response *http.Response
// nolint: bodyclose
response, err = c.client.Do(request)
if err != nil {
return nil, err
}
// response body is closed by caller
// actually, it's automatically closed by Data access
var rsp = NewResponse(response)
// run after hooks
c.runAfterHooks(req, rsp)
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ go 1.16

require (
github.com/fatih/structtag v1.2.0
github.com/pinealctx/neptune v0.8.4-0.20220513082456-ea94fa5e23b9
go.uber.org/zap v1.19.0
github.com/pinealctx/neptune v1.2.4
go.uber.org/zap v1.26.0
)
Loading

0 comments on commit 7c8ba81

Please sign in to comment.