fix repeated detection

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-04-19 10:08:28 +03:00
parent 0182d6ab56
commit ee9b7493e3

View File

@ -74,9 +74,13 @@ func newPathRequest(path string, method string, body string, msg interface{}, ta
// special // special
switch tn { switch tn {
case "protobuf": // special 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: default:
t = &tag{key: tn, name: tp[0], opts: tp[1:]} t = &tag{key: tn, name: tp[0]}
} }
if t.name != "" { if t.name != "" {
break break
@ -216,5 +220,4 @@ func (h *httpClient) parseRsp(ctx context.Context, hrsp *http.Response, rsp inte
type tag struct { type tag struct {
key string key string
name string name string
opts []string
} }