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

[2.7] Add support for keeping boolean values "as is" in query #603

Merged
merged 4 commits into from
Jul 18, 2024

Conversation

simPod
Copy link

@simPod simPod commented Apr 27, 2024

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 type boolean. 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.

@GrahamCampbell GrahamCampbell changed the title feat: add support for keeping boolean values "as is" in query [2.7] Add support for keeping boolean values "as is" in query Jul 18, 2024
@GrahamCampbell GrahamCampbell merged commit e47ccf6 into guzzle:2.6 Jul 18, 2024
21 checks passed
@GrahamCampbell
Copy link
Member

Oops. Merged to wrong branch, and missed readme updates. I'll re-submit this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants