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: handle datafile provided as bytes #384

Merged
merged 1 commit into from
Jun 2, 2022

Conversation

andrewleap-optimizely
Copy link
Contributor

Summary

  • If datafile is provided as bytes, convert to str

The PollingConfigManager provides the datafile as bytes.

Test plan

  • test_config.test_to_datafile_from_bytes
  • test_optimizely_config.test__get_datafile_from_bytes

Issues

Currently if the datafile is provided as bytes, including using the default PollingConfigManager, it is converted to str incorrectly, resulting in an invalid JSON string being returned from ProjectConfig.to_datafile and OptimizelyConfig.get_datafile.

Steps to replicate:

client = optimizely.Optimizely(sdk_key=sdk_key)
project_config = client.config_manager.get_config()
datafile = project_config.to_datafile()
json.loads(datafile)

Copy link
Contributor

@Mat001 Mat001 left a comment

Choose a reason for hiding this comment

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

LGTM

@andrewleap-optimizely andrewleap-optimizely merged commit 42f6663 into master Jun 2, 2022
@andrewleap-optimizely andrewleap-optimizely deleted the aleap/fix_datafile_export branch June 2, 2022 13:30
@alexanderchabo
Copy link

Hey @andrewleap-optimizely, do you know when this possibly is released? :)

Our team is somewhat blocked on this as the datafile is reported as malformed when digested in the javascript-sdk.

@andrewleap-optimizely
Copy link
Contributor Author

@alexanderchabo we have released this change in v4.1.0

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

3 participants