Skip to content

Commit acc2dc3

Browse files
committed
fix(test): handle integer values in mock getBoolParam
The mock's getBoolParam only handled bool and string types. When the client sends start=1 as a JSON integer it decodes as float64, falling through to the default branch and returning false. Add float64 and int cases so numeric 1/0 values correctly map to true/false.
1 parent ceffe4f commit acc2dc3

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

pkg/mockpve/state.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,6 +1539,10 @@ func getBoolParam(params map[string]interface{}, key string, fallback bool) bool
15391539
switch v := value.(type) {
15401540
case bool:
15411541
return v
1542+
case float64:
1543+
return v != 0
1544+
case int:
1545+
return v != 0
15421546
case string:
15431547
switch strings.ToLower(v) {
15441548
case "1", "true", "yes", "on":

0 commit comments

Comments
 (0)