diff --git a/cmd/protoc-gen-go-http/template.go b/cmd/protoc-gen-go-http/template.go index 54b9e4b28..3b70678a6 100644 --- a/cmd/protoc-gen-go-http/template.go +++ b/cmd/protoc-gen-go-http/template.go @@ -11,7 +11,7 @@ var httpTemplate = ` {{$svrName := .ServiceName}} {{- range .Methods}} -const Operation{{.OriginalName}} = "/{{$svrName}}/{{.OriginalName}}" +const Operation{{$svrType}}{{.OriginalName}} = "/{{$svrName}}/{{.OriginalName}}" {{- end}} type {{.ServiceType}}HTTPServer interface { @@ -51,7 +51,7 @@ func _{{$svrType}}_{{.Name}}{{.Num}}_HTTP_Handler(srv {{$svrType}}HTTPServer) fu return err } {{- end}} - http.SetOperation(ctx,Operation{{.OriginalName}}) + http.SetOperation(ctx,Operation{{$svrType}}{{.OriginalName}}) h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) { return srv.{{.Name}}(ctx, req.(*{{.Request}})) }) @@ -84,7 +84,7 @@ func (c *{{$svrType}}HTTPClientImpl) {{.Name}}(ctx context.Context, in *{{.Reque var out {{.Reply}} pattern := "{{.Path}}" path := binding.EncodeURL(pattern, in, {{not .HasBody}}) - opts = append(opts, http.Operation(Operation{{.OriginalName}})) + opts = append(opts, http.Operation(Operation{{$svrType}}{{.OriginalName}})) opts = append(opts, http.PathTemplate(pattern)) {{if .HasBody -}} err := c.cc.Invoke(ctx, "{{.Method}}", path, in{{.Body}}, &out{{.ResponseBody}}, opts...)