Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws: util always read resp.body #6734

Conversation

johanneslarsson
Copy link
Contributor

Why the changes in this PR are needed?

Currently we only read response body if the response is 200 or if we have debug flag enabled.

As the go package documentation states

If the Body is not both read to EOF and closed, the [Client](https://pkg.go.dev/net/http#Client)'s underlying [RoundTripper](https://pkg.go.dev/net/http#RoundTripper) (typically [Transport](https://pkg.go.dev/net/http#Transport)) may not be able to re-use a persistent TCP connection to the server for a subsequent "keep-alive" request.

A typical production server that receive errors responses from AWS will be less efficient.

What are the changes in this PR?

Always read the response.

Copy link

netlify bot commented May 6, 2024

Deploy Preview for openpolicyagent ready!

Name Link
🔨 Latest commit ca516e7
🔍 Latest deploy log https://app.netlify.com/sites/openpolicyagent/deploys/6638dd9b59720600088962a0
😎 Deploy Preview https://deploy-preview-6734--openpolicyagent.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@anderseknert anderseknert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Signed-off-by: Johannes Larsson <johannes.a.larsson@gmail.com>
@anderseknert anderseknert force-pushed the fix/aws-util-always-read-body branch from e6de843 to ca516e7 Compare May 6, 2024 13:39
@anderseknert anderseknert merged commit 7c0278e into open-policy-agent:main May 6, 2024
28 checks passed
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.

None yet

2 participants