Project

General

Profile

Defect #1583

when passing a boolean parameter to the API it is stransformed to a string

Added by Gerard Immeker over 1 year ago. Updated over 1 year ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Start date:
08/10/2022
Due date:
% Done:

0%

Estimated time:
Browser (if web client):

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

#1

Updated by Patrick Talbot over 1 year 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&parameter2=a+String&parameter3=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...

#2

Updated by Gerard Immeker over 1 year ago

Hi Patrick,

Thanks for your reply and clearification.

Also available in: Atom PDF