diff --git a/cmd/hz/protobuf/ast.go b/cmd/hz/protobuf/ast.go index 3b4759a2c..3ccfc9b51 100644 --- a/cmd/hz/protobuf/ast.go +++ b/cmd/hz/protobuf/ast.go @@ -353,6 +353,10 @@ func parseAnnotationToClient(clientMethod *generator.ClientMethod, gen *protogen val := fileAnnos.(string) clientMethod.FormFileCode += fmt.Sprintf("%q: req.Get%s(),\n", val, f.GoName) } + if proto.HasExtension(f.Desc.Options(), api.E_Cookie) { + hasAnnotation = true + // cookie do nothing + } if !hasAnnotation && strings.EqualFold(clientMethod.HTTPMethod, "get") { clientMethod.QueryParamsCode += fmt.Sprintf("%q: req.Get%s(),\n", checkSnakeName(string(f.Desc.Name())), f.GoName) } diff --git a/cmd/hz/thrift/ast.go b/cmd/hz/thrift/ast.go index d577b95db..83b27fd7f 100644 --- a/cmd/hz/thrift/ast.go +++ b/cmd/hz/thrift/ast.go @@ -321,6 +321,10 @@ func parseAnnotationToClient(clientMethod *generator.ClientMethod, p *parser.Typ hasFormAnnotation = true clientMethod.FormFileCode += fmt.Sprintf("%q: req.Get%s(),\n", fileName, field.GoName().String()) } + if anno := getAnnotation(field.Annotations, AnnotationCookie); len(anno) > 0 { + hasAnnotation = true + // cookie do nothing + } if !hasAnnotation && strings.EqualFold(clientMethod.HTTPMethod, "get") { clientMethod.QueryParamsCode += fmt.Sprintf("%q: req.Get%s(),\n", checkSnakeName(field.GetName()), field.GoName().String()) }