-
Notifications
You must be signed in to change notification settings - Fork 58
Improve UrlSearchParams handling of booleans #279
Comments
Since I was looking at UrlSearchParams already... is this ticket description actually the intended results? I would expect The only time it makes sense to skip a key would be if its value was This is also very closely related to #385 |
The issue is that query params values can only be strings, and there’s no unambiguous way to represent anything else. Converting boolean false to ”false” or “0” would be reasonable so long as the code that eventually uses it understands the convention, but just converting a false property to a bare property name is definitely not. It might be better to follow the spec of the URLSearchParams class, whose |
Currently,
UrlSearchParams#toString
will include key names for parameters with falsey values.Test:
new UrlSearchParams(<Hash<any>>{ debug: false, foo: 'bar' }).toString()
Expected output:
'foo=bar'
Actual output:
'debug&foo=bar'
The text was updated successfully, but these errors were encountered: