feat: Completion of pattern calls

pull/2663/head
FynnTang 2 years ago
parent b75513e426
commit ed8dfad79e
No known key found for this signature in database
GPG Key ID: FCCE381CD735692A
  1. 5
      cmd/protoc-gen-go-http/template.go

@ -86,10 +86,9 @@ func New{{.ServiceType}}HTTPClient (client *http.Client) {{.ServiceType}}HTTPCli
{{range .MethodSets}}
func (c *{{$svrType}}HTTPClientImpl) {{.Name}}(ctx context.Context, in *{{.Request}}, opts ...http.CallOption) (*{{.Reply}}, error) {
var out {{.Reply}}
pattern := Operation{{.Method}}{{.OriginalName}}URL
path := binding.EncodeURL(pattern, in, {{not .HasBody}})
path := binding.EncodeURL(Operation{{.Method}}{{.OriginalName}}URL, in, {{not .HasBody}})
opts = append(opts, http.Operation(Operation{{$svrType}}{{.OriginalName}}))
opts = append(opts, http.PathTemplate(pattern))
opts = append(opts, http.PathTemplate(Operation{{.Method}}{{.OriginalName}}URL))
{{if .HasBody -}}
err := c.cc.Invoke(ctx, "{{.Method}}", path, in{{.Body}}, &out{{.ResponseBody}}, opts...)
{{else -}}

Loading…
Cancel
Save