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

QueryStringSerializer.SerializeToString uses uppercase bools #586

Closed
ghost opened this issue Nov 30, 2017 · 5 comments

Comments

@ghost
Copy link

@ghost ghost commented Nov 30, 2017

With this set:
QueryStringSerializer.ComplexTypeStrategy = QueryStringStrategy.FormUrlEncoded;

...and then call:
QueryStringSerializer.SerializeToString

...on a DTO with a bool property set, the resulting query string contains uppercase boolean values ("True" or "False")

I think they should be lowercase by default ("true" or "false") to be consistent with default JSON serialization, which serializes bools lowercase.

@mythz

This comment has been minimized.

Copy link
Member

@mythz mythz commented Nov 30, 2017

The URL QueryString is unrelated to the JSON ContentType, it parses case-insensitive but uses the .NET Type ToString output by default.

Please reserve the IssueTracker for reproducible issues. You can submit feature requests on https://servicestack.uservoice.com/

@mythz mythz closed this Nov 30, 2017
@ghost

This comment has been minimized.

Copy link
Author

@ghost ghost commented Nov 30, 2017

@mythz Sorry, this is easily reproducible, and didn't seem like a feature request. More of a quick fix.

Sending uppercase bools in query strings doesn't seem like the standard way to do it. I've never seen it in various web requests I've observed - everything is usually lowercase. Example would be on the Stripe website:
https://dashboard.stripe.com/invoices?closed=false
They use lowercase.

It seems like it would be easily fixable by checking for bool in your code when serializing, and then call .ToString().ToLower().

@mythz

This comment has been minimized.

Copy link
Member

@mythz mythz commented Dec 1, 2017

No this is not an issue as it’s working exactly as intended and explained above, it’s your preference of which has never been requested before, you can submit a feature request for it in the link provided.

Source code showing how to lower case strings is absolutely not necessary.

@ghost

This comment has been minimized.

Copy link
Author

@ghost ghost commented Dec 1, 2017

Very well, I introduced it here:
https://servicestack.uservoice.com/forums/176786-feature-requests/suggestions/32443760-improve-querystringserializer-serializetostring-to

Admittedly, I was a bit wary of posting there since it doesn't seem like most requests get a lot of attention compared to this tracker. Hope you'll consider looking at this one - seems easy!

@mythz

This comment has been minimized.

Copy link
Member

@mythz mythz commented Dec 1, 2017

UserVoice is to measure interest in and prioritize feature requests, but this issue tracker is to resolve actual and reproducible issues.

Please note there is no web standard that mandates lower case query strings, if you plan on using terminology with distinct meaning please also include a link to the explicit web standard you're referencing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.