MCPcopy
hub / github.com/uber/aresdb / mixedHandler

Function mixedHandler

datanode/datanode.go:711–719  ·  view source on GitHub ↗

mixed handler for both grpc and traditional http

(grpcServer *grpc.Server, httpHandler http.Handler)

Source from the content-addressed store, hash-verified

709
710// mixed handler for both grpc and traditional http
711func mixedHandler(grpcServer *grpc.Server, httpHandler http.Handler) http.Handler {
712 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
713 if grpcServer != nil && r.ProtoMajor == 2 && strings.Contains(r.Header.Get(utils.HTTPContentTypeHeaderKey), utils.HTTPContentTypeApplicationGRPC) {
714 grpcServer.ServeHTTP(w, r)
715 } else {
716 httpHandler.ServeHTTP(w, r)
717 }
718 })
719}

Callers 1

ServeMethod · 0.85

Calls 2

ServeHTTPMethod · 0.80
GetMethod · 0.65

Tested by

no test coverage detected