-
-
Notifications
You must be signed in to change notification settings - Fork 232
Huma now accepts naked boolean queryparams #44
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #44 +/- ##
==========================================
+ Coverage 86.63% 86.64% +0.01%
==========================================
Files 24 24
Lines 1930 1932 +2
==========================================
+ Hits 1672 1674 +2
Misses 183 183
Partials 75 75
Continue to review full report at Codecov.
|
resolver.go
Outdated
| } else if req.URL.Query().Has(name) { | ||
| // name has no associated value, but exists in the map of QueryParams. This is a boolean value | ||
| pv = "true" |
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.
I think we also need to check that the type is a boolean here, otherwise for your example tests below I think going GET /?s=&b will actually set the string to "true" rather than "". It's an edge case for sure, but probably one we want to avoid if possible.
danielgtaylor
left a comment
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.
LGTM 👍
Today in order to use a boolean with queryparams it needs to be set like this:
?param=true, now you can set it with?paramor?param