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

builder: don't use setParamIfDefined on bools #225

Merged
merged 1 commit into from
Sep 12, 2023

Conversation

lbajolet-hashicorp
Copy link
Contributor

The `setDeviceParamIfDefined' function only works on strings, and checks that the value is not empty before adding the parameter to the request.

In the builder code, in several places, there are some instances of booleans being converted to strings using strconv.FormatBool', and then calling setDeviceParamIfDefined' with this value, meaning that the value always gets set in the request.

This commit removes those instances in favour of a manual boolean check, which can result in adding the parameter to the request only if it is set to true.

The `setDeviceParamIfDefined' function only works on strings, and checks
that the value is not empty before adding the parameter to the request.

In the builder code, in several places, there are some instances of
booleans being converted to strings using `strconv.FormatBool', and then
calling `setDeviceParamIfDefined' with this value, meaning that the
value always gets set in the request.

This commit removes those instances in favour of a manual boolean check,
which can result in adding the parameter to the request only if it is
set to true.
@lbajolet-hashicorp lbajolet-hashicorp requested a review from a team as a code owner September 12, 2023 15:41
Copy link
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lbajolet-hashicorp lbajolet-hashicorp merged commit 4f91598 into main Sep 12, 2023
@lbajolet-hashicorp lbajolet-hashicorp deleted the redo_bool_set_params branch September 12, 2023 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants