-
Notifications
You must be signed in to change notification settings - Fork 59
feat: demo null value defaulting #1358
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,14 +121,21 @@ export const handlers = [ | |
} | ||
|
||
const scopeValue = new URL(info.request.url).searchParams.get('scope'); | ||
const key = info.params.key; | ||
const reason = key.includes('null-value') | ||
? StandardResolutionReasons.DEFAULT | ||
: requestBody.context?.targetingKey | ||
? StandardResolutionReasons.TARGETING_MATCH | ||
: StandardResolutionReasons.STATIC; | ||
|
||
const value = key.includes('null-value') ? null : true; | ||
Comment on lines
+125
to
+131
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Send back a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would we need to send a variant at all? |
||
const variant = key.includes('null-value') ? undefined : scopeValue ? 'scoped' : 'default'; | ||
|
||
return HttpResponse.json<EvaluationResponse>({ | ||
key: info.params.key, | ||
reason: requestBody.context?.targetingKey | ||
? StandardResolutionReasons.TARGETING_MATCH | ||
: StandardResolutionReasons.STATIC, | ||
variant: scopeValue ? 'scoped' : 'default', | ||
value: true, | ||
reason, | ||
variant, | ||
value, | ||
metadata: TEST_FLAG_METADATA, | ||
}); | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test runs with 2 different defaults, and gets the default value both times since we send back a nullish
value
in OFREP