mirror of
https://github.com/pocketbase/pocketbase.git
synced 2025-03-30 09:22:37 +02:00
added negative number test
This commit is contained in:
parent
2e8e835a68
commit
edd2eaae88
@ -118,7 +118,7 @@ func normalizeMultipartValue(raw string) any {
|
|||||||
case "false":
|
case "false":
|
||||||
return false
|
return false
|
||||||
default:
|
default:
|
||||||
if raw[0] >= '0' && raw[0] <= '9' {
|
if raw[0] == '-' || (raw[0] >= '0' && raw[0] <= '9') {
|
||||||
if v, err := cast.ToFloat64E(raw); err == nil {
|
if v, err := cast.ToFloat64E(raw); err == nil {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
@ -43,14 +43,14 @@ func TestBindBody(t *testing.T) {
|
|||||||
url.Values{
|
url.Values{
|
||||||
"string": []string{"str"},
|
"string": []string{"str"},
|
||||||
"stings": []string{"str1", "str2"},
|
"stings": []string{"str1", "str2"},
|
||||||
"number": []string{"123"},
|
"number": []string{"-123"},
|
||||||
"numbers": []string{"123", "456"},
|
"numbers": []string{"123", "456"},
|
||||||
"bool": []string{"true"},
|
"bool": []string{"true"},
|
||||||
"bools": []string{"true", "false"},
|
"bools": []string{"true", "false"},
|
||||||
}.Encode(),
|
}.Encode(),
|
||||||
),
|
),
|
||||||
echo.MIMEApplicationForm,
|
echo.MIMEApplicationForm,
|
||||||
`{"bool":true,"bools":["true","false"],"number":123,"numbers":["123","456"],"stings":["str1","str2"],"string":"str"}`,
|
`{"bool":true,"bools":["true","false"],"number":-123,"numbers":["123","456"],"stings":["str1","str2"],"string":"str"}`,
|
||||||
false,
|
false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user