Move wrapper internally since its not top level relevant

This commit is contained in:
Asim Aslam
2019-11-16 18:48:24 +00:00
parent a1c6cdf193
commit 90d7a87914
4 changed files with 24 additions and 9 deletions

View File

@@ -12,9 +12,9 @@ import (
"github.com/micro/go-micro/debug/handler"
"github.com/micro/go-micro/debug/profile"
"github.com/micro/go-micro/debug/profile/pprof"
"github.com/micro/go-micro/metadata"
"github.com/micro/go-micro/plugin"
"github.com/micro/go-micro/server"
"github.com/micro/go-micro/util/wrapper"
"github.com/micro/go-micro/util/log"
)
@@ -27,12 +27,11 @@ type service struct {
func newService(opts ...Option) Service {
options := newOptions(opts...)
options.Client = &clientWrapper{
options.Client,
metadata.Metadata{
HeaderPrefix + "From-Service": options.Server.Options().Name,
},
}
// service name
serviceName := options.Server.Options().Name
// wrap client to inject From-Service header on any calls
options.Client = wrapper.FromService(serviceName, options.Client)
return &service{
opts: options,