Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot test if required integer query parameter is empty #922

Open
duharound opened this issue Feb 26, 2024 · 0 comments
Open

Cannot test if required integer query parameter is empty #922

duharound opened this issue Feb 26, 2024 · 0 comments

Comments

@duharound
Copy link

When having an endpoint like this

ENDPOINT("GET", "/ids", getId, QUERY(Int32, id))

it is not possible for me to check if the endpoint was called with an empty query parameter id, i.e. /ids?id=.
The problem is, that when the string to int32 conversion is performed like

bool success;
v_int32 number = oatpp::utils::conversion::strToInt32(oatpp::String(""), success);

the conversion of the empty string returns the number 0 and success is set to true. The reason is the comparison with the string length here. In the given example, this means that id would automatically default to 0. What should I do, if I would like to have a different default value?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant