diff --git a/struct_utils/struct_utils.go b/struct_utils/struct_utils.go index 384feb3cc58b35d2bab4e3661f285d161bfb41a2..4d233b6434115d0381a25071542b8807851483b9 100644 --- a/struct_utils/struct_utils.go +++ b/struct_utils/struct_utils.go @@ -15,11 +15,20 @@ func FormToKeyValuePairs(body string) []KeyValuePair { parts := strings.Split(body, "&") for _, p := range parts { split := strings.Split(p, "=") - k := split[0] - v := split[1] + + var key string + if len(split) > 0 { + key = split[0] + } + + var value string + if len(split) > 1 { + key = split[1] + } + kv := KeyValuePair{ - Key: k, - Value: v, + Key: key, + Value: value, } out = append(out, kv) }