ServeHTTP serves an HTTP request. If the Content-Type is application/grpc, the request is routed to gRPC. Otherwise, the request is routed to the default web server.
(w http.ResponseWriter, r *http.Request)
| 454 | // If the Content-Type is application/grpc, the request is routed to gRPC. |
| 455 | // Otherwise, the request is routed to the default web server. |
| 456 | func (c *Component) ServeHTTP(w http.ResponseWriter, r *http.Request) { |
| 457 | if r.ProtoMajor == 2 && strings.Contains(r.Header.Get("Content-Type"), "application/grpc") { |
| 458 | c.GRPC.Server.ServeHTTP(w, r) |
| 459 | } else { |
| 460 | c.web.ServeHTTP(w, r) |
| 461 | } |
| 462 | } |
| 463 | |
| 464 | // CAStore returns the component's CA Store. |
| 465 | func (c *Component) CAStore() *mtls.CAStore { |