aio-libs / yarl

Yet another URL library

Home Page:https://yarl.aio-libs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow bool type at query var

jujumilk3 opened this issue · comments

Is your feature request related to a problem?

No response

Describe the solution you'd like

I just PRed it.
Add case of bool type at URL class's def _query_var.

Describe alternatives you've considered

No idea.

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct

This is explicitly addressed in the documention:

Why isn’t boolean supported by the URL query API?

There is no standard for boolean representation of boolean values.

Some systems prefer true/false, others like yes/no, on/off, Y/N, 1/0, etc.

yarl cannot make an unambiguous decision on how to serialize bool values because it is specific to how the end-user’s application is built and would be different for different apps. The library doesn’t accept booleans in the API; a user should convert bools into strings using own preferred translation protocol.