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: encode serialized JSON string as UTF-8 #121

Merged
merged 2 commits into from
Aug 18, 2021
Merged

Conversation

pyrooka
Copy link
Member

@pyrooka pyrooka commented Aug 17, 2021

This PR adds encoding to the serialized JSON payload. We are already doing this if the payload is passed as a string.

In the generated SDKs, for example in the Platform Services/Case Management, we serialize the data dictionary and pass it to the prepare_request function as a string, therefore I think it's safe to add encoding here.

@codecov
Copy link

codecov bot commented Aug 17, 2021

Codecov Report

Merging #121 (f5dfa5c) into main (5395f65) will increase coverage by 0.48%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #121      +/-   ##
==========================================
+ Coverage   99.01%   99.50%   +0.48%     
==========================================
  Files          22       22              
  Lines         816      815       -1     
==========================================
+ Hits          808      811       +3     
+ Misses          8        4       -4     
Impacted Files Coverage Δ
ibm_cloud_sdk_core/base_service.py 99.47% <100.00%> (+2.08%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5395f65...f5dfa5c. Read the comment docs.

Comment on lines -376 to +375
if sys.version_info >= (3, 0) and isinstance(data, str):
if isinstance(data, str):
Copy link
Member Author

@pyrooka pyrooka Aug 17, 2021

Choose a reason for hiding this comment

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

We don't support Python 2 as far as I know, so I removed this version check.

@pyrooka pyrooka requested a review from padamstx August 17, 2021 14:47
Copy link
Member

@padamstx padamstx left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@dpopp07 dpopp07 left a comment

Choose a reason for hiding this comment

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

Looks good! 👍

@pyrooka pyrooka merged commit 6c1ddac into main Aug 18, 2021
@pyrooka pyrooka deleted the character-encoding branch August 18, 2021 16:37
ibm-devx-sdk pushed a commit that referenced this pull request Aug 18, 2021
## [3.11.1](v3.11.0...v3.11.1) (2021-08-18)

### Bug Fixes

* encode serialized JSON string as UTF-8 ([#121](#121)) ([6c1ddac](6c1ddac))
@ibm-devx-sdk
Copy link

🎉 This PR is included in version 3.11.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants