|
@@ -70,11 +70,13 @@ func (svr *Service) Handle(method string, cb HandleFunc, opts ...HandleOption) {
|
|
|
}
|
|
|
//HTTP处理
|
|
|
if svr.opts.EnableHttp && !opt.DisableHttp {
|
|
|
- path := strings.ReplaceAll(method, ".", "/")
|
|
|
- if path[0] != '/' {
|
|
|
- path = "/" + path
|
|
|
+ if opt.HttpPath == "" {
|
|
|
+ opt.HttpPath = strings.ReplaceAll(method, ".", "/")
|
|
|
}
|
|
|
- svr.httpSvr.Handle(opt.HttpMethod, path, func(ctx *http.Context) (err error) {
|
|
|
+ if opt.HttpPath[0] != '/' {
|
|
|
+ opt.HttpPath = "/" + opt.HttpPath
|
|
|
+ }
|
|
|
+ svr.httpSvr.Handle(opt.HttpMethod, opt.HttpPath, func(ctx *http.Context) (err error) {
|
|
|
return cb(ctx)
|
|
|
})
|
|
|
}
|