Defect #1583
when passing a boolean parameter to the API it is stransformed to a string
0%
Description
Hi,
When calling the API with with a boolean query parameter, the parameter will be passed as a string
example:
url: https://someurl.nl/solutionname/servoy-service/velocity/modulename/endpoint?breakfast=true
parsed request.parameters.breakfast ='true'
Is this as designed?
History
Updated by Patrick Talbot almost 3 years ago
- Status changed from New to Rejected
Well, in the case of a GET requests like your example, all parameters are received as Strings, so nothing tells Velocity that the "breakfast" parameter in your example is in fact a boolean...
For POST requests, depending on how you choose to pass parameters (the enctype parameter of a form - by default "application/x-www-form-urlencoded"), it's the same, meaning in most case a POST from a form will be translated to a body of concatenated values (but with no size limit), like:
parameterA=1¶meter2=a+String¶meter3=true
You see, it's not up to the plugin to determine, based on String values received, whether "true" should be treated as true or "true"...
So it's not by design in the plugin per-se, it's rather by design in the http(s) protocol...
Updated by Gerard Immeker almost 3 years ago
Hi Patrick,
Thanks for your reply and clearification.