VividCortex / siesta

Composable framework for writing HTTP handlers in Go.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Valueless boolean parameters

ElPeque opened this issue · comments

@mtrias told me he liked boolean parameters to default to false, and asume true when sent with no value.

ex: ?someparam=4&booleanparam&someotherparam=6

in this case, the booleanparam is assumed as booleanparam=true

For this, we'll have to define our own bool type that satisfies the flag.Value interface. The default one uses strconv.ParseBool to parse the value string and it doesn't accept empty strings.