Skip to content
Snippets Groups Projects
Commit 1e1c13a5 authored by Jano Hendriks's avatar Jano Hendriks
Browse files

Ignore empty arrays for non-string query parameter fields

parent 5640938e
Branches
Tags v1.194.0
No related merge requests found
......@@ -263,6 +263,10 @@ func unmarshalNamedValuesIntoStructPtr(prefix string, namedValues map[string][]s
if structTypeField.Type.Kind() == reflect.Slice {
// this param struct field is a slice, iterate over all specified values
for i, fieldValue := range fieldValues {
if fieldValue == "[]" && structTypeField.Type.Elem().Kind() != reflect.String {
// empty array - do nothing
continue
}
parsedValue, parseErr := unmarshalValue(fieldValue, structTypeField.Type.Elem())
if parseErr != nil {
err = errors.Wrapf(parseErr, "invalid %s[%d]", fieldName, i)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment