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

fix: use reader for bytes http response transformation #702

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

rogercoll
Copy link
Contributor

The From implementation to transform a ureq::Response into an http::Response<Vec> is using the into_string() method. This method only allows for UTF-8 characters in the body payload, thus the result is inconsistent for non UTF-8 characters like protobuffers (binary).

The proposed solution uses the reader instead of transforming the input into a UTF-8 character.

The From implementation to transform a ureq::Response into an
http::Response<Vec<u8>> is using the into_string() method. This method
only allows for UTF-8 characters in the body payload, thus the
result is inconsistent for non UTF-8 characters like protobuffers (binary).

The proposed solution uses the reader instead of transforming the input
into a UTF-8 character.
@algesten
Copy link
Owner

Thanks!

I will get my head around this soon. Currently I'm blocked on trying to fix: #688

@rogercoll
Copy link
Contributor Author

Hi @algesten, any update on this small fix? Thank you!

Copy link
Owner

@algesten algesten left a comment

Choose a reason for hiding this comment

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

Yeah. Going via utf-8 seems just wrong. Thanks!

@algesten algesten merged commit 4602c65 into algesten:main Mar 11, 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.

None yet

2 participants