soulbird commented on code in PR #8364:
URL: https://github.com/apache/apisix/pull/8364#discussion_r1040323102
##########
t/grpc_server_example/main.go:
##########
@@ -217,6 +223,21 @@ func (s *server) Run(ctx context.Context, in *pb.Request)
(*pb.Response, error)
return &pb.Response{Body: in.User.Name + " " + in.Body}, nil
}
+func gRPCAndHTTPFunc(grpcServer *grpc.Server) http.Handler {
+ return h2c.NewHandler(http.HandlerFunc(func(w http.ResponseWriter, r
*http.Request) {
+ mux := http.NewServeMux()
+ mux.HandleFunc("/", func(w http.ResponseWriter, r
*http.Request) {
+ w.Write([]byte("hello http"))
+ })
+
+ if r.ProtoMajor == 2 &&
strings.Contains(r.Header.Get("Content-Type"), "application/grpc") {
Review Comment:
It looks like this is a library for routing distributions? It doesn't have
any documentation description. For this test case, I think it would be better
to be simple and direct, and there is no performance pursuit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]