Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
shmsr committed Jun 4, 2024
1 parent c81da8f commit 6ebb08b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
1 change: 1 addition & 0 deletions x-pack/filebeat/input/httpjson/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func (p *Policy) CustomRetryPolicy(ctx context.Context, resp *http.Response, err
if resp.StatusCode == 0 || (resp.StatusCode >= 500 && resp.StatusCode != 501) {
defer func() {
if resp.Body != nil {
io.Copy(io.Discard, resp.Body)

Check failure on line 96 in x-pack/filebeat/input/httpjson/policy.go

View workflow job for this annotation

GitHub Actions / lint (windows)

Error return value of `io.Copy` is not checked (errcheck)
resp.Body.Close()
}
}()
Expand Down
5 changes: 0 additions & 5 deletions x-pack/filebeat/input/httpjson/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -675,11 +675,6 @@ func (r *requester) processChainPaginationEvents(ctx context.Context, trCtx *tra
if err != nil {
return -1, fmt.Errorf("failed to collect response: %w", err)
}
defer func() {
if httpResp != nil && httpResp.Body != nil {
httpResp.Body.Close()
}
}()

// store data according to response type
if i == len(r.requestFactories)-1 && len(ids) != 0 {
Expand Down

0 comments on commit 6ebb08b

Please sign in to comment.