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

ec2plugin: fallback to utf8 if response encoding not set #278

Merged
merged 1 commit into from
Jan 3, 2023
Merged

ec2plugin: fallback to utf8 if response encoding not set #278

merged 1 commit into from
Jan 3, 2023

Conversation

a-jackson
Copy link
Contributor

Issue #, if available: #277

Description of changes:

If repsonse.ContentEncoding is not set then this will fallback to UTF8 to prevent an exception.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@a-jackson a-jackson requested a review from a team as a code owner November 23, 2022 16:52
@srprash
Copy link
Collaborator

srprash commented Nov 25, 2022

Hi @a-jackson
Thanks for opening this PR. Can you add a corresponding unit test for the fix too?

@a-jackson
Copy link
Contributor Author

Hi @srprash

Just managed to get back to this, there doesn't appear to be any unit tests for the EC2Plugin at all right now and I'm not really sure how I'd do it given that is sends Http requests to the hard coded metadata endpoint.

@srprash
Copy link
Collaborator

srprash commented Jan 3, 2023

Hi @a-jackson
The unit tests for EC2 plugin are here. The tests use a mocked EC2Plugin to return some predefined values. Can you give the tests a look and see if you can incorporate the new unit test for this change without a lot of effort?

@a-jackson
Copy link
Contributor Author

I'm not really sure what you're after with that? If it's using a mocked EC2Plugin then it isn't going to be executing the code I have changed.

@srprash
Copy link
Collaborator

srprash commented Jan 3, 2023

Ah I see. We mock the DoRequest method from the plugin so it will be difficult to test the change without having to re-structure the existing unit tests.
Given that this is a very minor change to add more code robustness and the unit testing effort is comparatively large, I think it is acceptable to merge this PR as is.

Thanks @a-jackson for contributing!

@srprash srprash merged commit c285b7d into aws:master Jan 3, 2023
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