Skip to content

Commit

Permalink
make bool of/to_url_query consistent with other types
Browse files Browse the repository at this point in the history
  • Loading branch information
tatchi authored and andreypopp committed Jun 13, 2024
1 parent 13c994b commit 988e159
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions native/runtime/ppx_deriving_router_primitives.ml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ let int_of_url_query k xs =
| None -> Error "not an integer value"
| Some x -> Ok x))

let bool_to_url_query k x = if x then [ k, "true" ] else []
let bool_to_url_query k x = if x then [ k, "true" ] else [ k, "false" ]

let bool_of_url_query k xs =
last_wins k xs (function
| None -> Ok false
| None -> Error "missing value"
| Some "true" -> Ok true
| Some "false" -> Ok false
| _ -> Error "not a boolean value (true, false)")
Expand Down

0 comments on commit 988e159

Please sign in to comment.