Skip to content

Avoid resource leak in timestamp_infos#120

Merged
ddelemeny merged 1 commit intomainfrom
ddelemeny/fix-body-close
Apr 15, 2024
Merged

Avoid resource leak in timestamp_infos#120
ddelemeny merged 1 commit intomainfrom
ddelemeny/fix-body-close

Conversation

@ddelemeny
Copy link
Copy Markdown
Collaborator

Response.Body should be closed in any case

If the returned error is nil, the Response will contain a non-nil Body which the user is expected to close. If the Body is not both read to EOF and closed, the Client's underlying RoundTripper (typically Transport) may not be able to re-use a persistent TCP connection to the server for a subsequent "keep-alive" request.

https://pkg.go.dev/net/http#Client.Do

@ddelemeny ddelemeny merged commit fe3e009 into main Apr 15, 2024
@ddelemeny ddelemeny deleted the ddelemeny/fix-body-close branch April 18, 2024 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant