|
|
|
@ -46,7 +46,7 @@ func _{{$svrType}}_{{.Name}}{{.Num}}_HTTP_Handler(srv {{$svrType}}HTTPServer) fu |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
{{- end}} |
|
|
|
|
http.SetOperation(ctx,"/{{$svrName}}/{{.Name}}") |
|
|
|
|
http.SetOperation(ctx,"/{{$svrName}}/{{.OriginalName}}") |
|
|
|
|
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) { |
|
|
|
|
return srv.{{.Name}}(ctx, req.(*{{.Request}})) |
|
|
|
|
}) |
|
|
|
@ -79,7 +79,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("/{{$svrName}}/{{.Name}}")) |
|
|
|
|
opts = append(opts, http.Operation("/{{$svrName}}/{{.OriginalName}}")) |
|
|
|
|
opts = append(opts, http.PathTemplate(pattern)) |
|
|
|
|
{{if .HasBody -}} |
|
|
|
|
err := c.cc.Invoke(ctx, "{{.Method}}", path, in{{.Body}}, &out{{.ResponseBody}}, opts...) |
|
|
|
@ -104,10 +104,11 @@ type serviceDesc struct { |
|
|
|
|
|
|
|
|
|
type methodDesc struct { |
|
|
|
|
// method
|
|
|
|
|
Name string |
|
|
|
|
Num int |
|
|
|
|
Request string |
|
|
|
|
Reply string |
|
|
|
|
Name string |
|
|
|
|
OriginalName string // The parsed original name
|
|
|
|
|
Num int |
|
|
|
|
Request string |
|
|
|
|
Reply string |
|
|
|
|
// http_rule
|
|
|
|
|
Path string |
|
|
|
|
Method string |
|
|
|
|