better boolean support with http query args

Bug #1493982 reported by Justin Wood
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
WSME
New
Undecided
Unassigned

Bug Description

(from: https://github.com/mozilla/build-relengapi/issues/197)

In my use case I have an endpoint that takes url query params. This endpoint's param should accept boolean values (Null/None, 1, 0, True, False) and case insensitive at that...

While, the wsme framework will convert anything other than "" and None python types to true, such that "0" and "false" are both True as per the endpoint.

So to clarify, I'd like:

    http://foo.com/bar?arg= -> False
    http://foo.com/bar?arg=0 -> False
    http://foo.com/bar?arg=false -> False
    http://foo.com/bar?arg=true -> True
    http://foo.com/bar?arg=1 -> True

Revision history for this message
Christophe de Vienne (cdevienne) wrote :

Sounds reasonable.
There may be somewhere some code depending on "0" or "false" to be True, so we need to be carefull but otherwise I am +1

Revision history for this message
Christophe de Vienne (cdevienne) wrote :

I would add "yes" and "no", and raise an error (maybe a deprecation-warning to start with) if a non-recognised string is found.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.