Skip to content

aws: util always read resp.body#6734

Merged
anderseknert merged 1 commit intoopen-policy-agent:mainfrom
johanneslarsson:fix/aws-util-always-read-body
May 6, 2024
Merged

aws: util always read resp.body#6734
anderseknert merged 1 commit intoopen-policy-agent:mainfrom
johanneslarsson:fix/aws-util-always-read-body

Conversation

@johanneslarsson
Copy link
Copy Markdown
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.

@netlify
Copy link
Copy Markdown

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
Copy Markdown
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
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.

2 participants