From ee9b7493e3c098e282051b1eaa49f85fc9ab4539 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Mon, 19 Apr 2021 10:08:28 +0300 Subject: [PATCH] fix repeated detection Signed-off-by: Vasiliy Tolstov --- util.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/util.go b/util.go index d1e233e..4f5a4b6 100644 --- a/util.go +++ b/util.go @@ -74,9 +74,13 @@ func newPathRequest(path string, method string, body string, msg interface{}, ta // special switch tn { case "protobuf": // special - t = &tag{key: tn, name: tp[3][5:], opts: append(tp[:3], tp[4:]...)} + for _, p := range tp { + if idx := strings.Index(p, "name="); idx > 0 { + t = &tag{key: tn, name: p[idx:]} + } + } default: - t = &tag{key: tn, name: tp[0], opts: tp[1:]} + t = &tag{key: tn, name: tp[0]} } if t.name != "" { break @@ -216,5 +220,4 @@ func (h *httpClient) parseRsp(ctx context.Context, hrsp *http.Response, rsp inte type tag struct { key string name string - opts []string }