From f3573e651b6f6ff78cb91df71f7fe6062f2a815a Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Fri, 9 Jul 2021 18:22:40 +0300 Subject: [PATCH] fix field setting Signed-off-by: Vasiliy Tolstov --- util.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/util.go b/util.go index c9dc1dc..8db38fe 100644 --- a/util.go +++ b/util.go @@ -124,8 +124,10 @@ func newPathRequest(path string, method string, body string, msg interface{}, ta default: fieldsmap[t.name] = fmt.Sprintf("%v", val.Interface()) } - } else if (body == "*" || body == t.name) && method != http.MethodGet && tnmsg.Field(i).CanSet() { - tnmsg.Field(i).Set(val) + } else if (body == "*" || body == t.name) && method != http.MethodGet { + if tnmsg.Field(i).CanSet() { + tnmsg.Field(i).Set(val) + } } else { if val.Type().Kind() == reflect.Slice { for idx := 0; idx < val.Len(); idx++ {