[2.7] Add support for keeping boolean values "as is" in query #603
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.
I've stumbled upon this for like milion times now.
This is a follow up of #391
Currently, there's no way not to cast boolean values to int in a query.
http_build_query()
casts booleans to ints, however, that is not always the wanted behaviour when constructing a query to call some API.E.g. Swagger sends
=true
=false
for params of typeboolean
. There are APIs that require this value format (e.g. https://github.com/PowerDNS/pdns).This has been discussed many times over and over and the conclusion I make of it is that the behaviour should be configurable since it depends on the target API (e.g. see OpenAPITools/openapi-generator#2204).
Therefore, I propose a flag that allows switch the behaviour in
Query::build()
. It should be BC compatible with the default value.