1
0
mirror of https://github.com/go-kratos/kratos.git synced 2026-05-22 10:15:24 +02:00

Revert/root ctx v2 (#1088)

* Revert "remove app info (#1081)"

This reverts commit 1dab58616b.

* add http base ctx

Co-authored-by: longXboy <longxboyhi@gmail.com>
This commit is contained in:
Tony Chen
2021-06-20 23:00:27 +08:00
committed by GitHub
parent b4dd478bc9
commit 59f54b2661
6 changed files with 165 additions and 9 deletions
+2 -1
View File
@@ -32,7 +32,8 @@ func (s *server) SayHello(ctx context.Context, in *helloworld.HelloRequest) (*he
if md, ok := metadata.FromServerContext(ctx); ok {
extra = md.Get("x-md-global-extra")
}
return &helloworld.HelloReply{Message: fmt.Sprintf("Hello %s and %s", in.Name, extra)}, nil
info, _ := kratos.FromContext(ctx)
return &helloworld.HelloReply{Message: fmt.Sprintf("Hello %s extra: %s name: %s", in.Name, extra, info.Name())}, nil
}
func main() {