embed/serve.go
func grpcHandlerFunc(grpcServer *grpc.Server, otherHandler http.Handler) http.Handler {
	if otherHandler == nil {
		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			grpcServer.ServeHTTP(w, r)
		})
	}
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		if r.ProtoMajor == 2 && strings.Contains(r.Header.Get("Content-Type"), "application/grpc") {
			grpcServer.ServeHTTP(w, r)
		} else {
			otherHandler.ServeHTTP(w, r)
		}
	})
}
func grpcHandlerFunc(grpcServer *grpc.Server, otherHandler http.Handler) http.Handler {
	if otherHandler == nil {
		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			grpcServer.ServeHTTP(w, r)
		})
	}
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		if r.ProtoMajor == 2 && strings.Contains(r.Header.Get("Content-Type"), "application/grpc") {
			grpcServer.ServeHTTP(w, r)
		} else {
			otherHandler.ServeHTTP(w, r)
		}
	})
}
func grpcHandlerFunc ( grpcServer * grpc . Server , otherHandler http . Handler ) http . Handler { if otherHandler == nil { return http . HandlerFunc ( func ( w http . ResponseWriter , r * http . Request ) { grpcServer . ServeHTTP ( w , r ) } ) } return http . HandlerFunc ( func ( w http . ResponseWriter , r * http . Request ) { if r . ProtoMajor == 2 && strings . Contains ( r . Header . Get ( " " ) , " " ) { grpcServer . ServeHTTP ( w , r ) } else { otherHandler . ServeHTTP ( w , r ) } } ) }
// grpcHandlerFunc returns an http.Handler that delegates to grpcServer on incoming gRPC
// connections or otherHandler otherwise. Given in gRPC docs.
grpcHandlerFunc returns an http . Handler that delegates to grpcServer on incoming gRPC connections or otherHandler otherwise . Given in gRPC docs .