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: response encode mismatch #215

Merged
merged 2 commits into from
Nov 21, 2024

Conversation

marocchino
Copy link
Contributor

@marocchino marocchino commented Nov 21, 2024

About the changes

Ruby's file writing defaults to utf-8, but net http's response seems to be based on the header and ASCII is used by default when no specification is made.
I didn't write any test files, but I verified them as follows:

# run with main branch
bin/spring stop
bin/rails c
> Unleash::Client.new
[Unleash] ERROR: Unable to save backup file. Exception thrown Encoding::UndefinedConversionError:'"\xE3" from ASCII-8BIT to UTF-8'
...
# run with this branch
bin/spring stop
bin/rails c
> Unleash::Client.new
(no error)

Closes #214

Important files

Discussion points

@@ -24,6 +24,7 @@ def self.post(uri, body)
def self.http_connection(uri)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
http.response_body_encoding = 'UTF-8'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@coveralls
Copy link

Pull Request Test Coverage Report for Build 11944771961

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 95.385%

Totals Coverage Status
Change from base Build 11814257586: 0.01%
Covered Lines: 434
Relevant Lines: 455

💛 - Coveralls

@sighphyre sighphyre self-assigned this Nov 21, 2024
@sighphyre
Copy link
Member

Thanks for the fix, seems reasonable

Copy link
Member

@sighphyre sighphyre left a comment

Choose a reason for hiding this comment

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

LGTM

@sighphyre sighphyre merged commit 744b728 into Unleash:main Nov 21, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Encoding issue with old backup file
3 participants