You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/12/06 01:31:30 UTC

[GitHub] [apisix] soulbird commented on a diff in pull request #8364: fix: proxy grpc sometimes occurs 502

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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org