Skip to content

Commit

Permalink
Merge pull request #291 from lupinelab/params-array
Browse files Browse the repository at this point in the history
fix: support array of values for param
mleone87 authored Jan 2, 2024
2 parents 1b594e6 + 054810d commit 0b0c911
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions proxmox/session.go
Original file line number Diff line number Diff line change
@@ -109,6 +109,11 @@ func ParamsToValuesWithAllEmpty(params map[string]interface{}, allowedEmpty []st
} else {
v = "0"
}
case []string:
for _, v := range intrV {
vals.Add(k, fmt.Sprintf("%v", v))
}
continue
default:
v = fmt.Sprintf("%v", intrV)
}
6 changes: 6 additions & 0 deletions proxmox/session_test.go
Original file line number Diff line number Diff line change
@@ -29,6 +29,12 @@ func TestParamsTo(t *testing.T) {
"comment": "",
},
output: []string{"poolid=test"},
}, {
name: "array",
input: map[string]interface{}{
"command": []string{"bash", "-c", "echo test"},
},
output: []string{"command=bash&command=-c&command=echo+test"},
}}

for _, test := range tests {

0 comments on commit 0b0c911

Please sign in to comment.