fix(flags): don't cast "" to None when returning feature flag payloads
#300
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: Return FeatureFlagResult for empty string payloads
Problem
When a feature flag variant has an empty string (
"") as its payload,get_feature_flag_result()returnsNoneinstead of aFeatureFlagResultobject with the empty string payload.Solution
Updated falsy checks throughout the codebase to use explicit
is not Nonechecks instead of relying on Python's truthiness. This ensures empty strings are properly handled as valid payloads.Changes
client.pyto checkis not Noneinstead of truthinesstypes.pyto avoid JSON parsing empty stringsTesting
Added tests to verify:
get_feature_flag_result()returns a properFeatureFlagResultwith empty string payloadget_all_flags_and_payloads()includes flags with empty string payloadsCloses #296