Commit 4060a4f
cpprest: Add conversion for bool in query param (#71)
Due to c++ conversion rules, bools in query parameters were passed as 1
an 0 (using a bool -> int implicit conversion) instead of true and false.
The OpenAPI 3 spec has this to say about the value of a boolean:
> Boolean
> type: boolean represents two values: true and false. Note that truthy and
> falsy values such as "true", "", 0 or null are not considered boolean values.
This commit adds a util function to convert a bool query param into a
true or false as a query param.
Before:
GET /foo?bar=0 HTTP/1.1
After:
GET /foo?bar=false HTTP/1.11 parent f5e7fe1 commit 4060a4f
File tree
2 files changed
+8
-0
lines changed- templates/cpprest
2 files changed
+8
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
34 | 41 | | |
35 | 42 | | |
36 | 43 | | |
| |||
0 commit comments