MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / ServeHTTP

Method ServeHTTP

pkg/component/component.go:456–462  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
456func (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.
465func (c *Component) CAStore() *mtls.CAStore {

Callers 11

TestOAuthFlowFunction · 0.95
TestTokenExchangeFunction · 0.95
TestWebFunction · 0.95
TestGetGatewayFunction · 0.95
TestGetFrequencyPlanFunction · 0.95
TestApplicationServerFunction · 0.95
TestWebhooksFunction · 0.95
TestAuthenticationFunction · 0.95
RegisterRoutesMethod · 0.45
ProtocolAuthenticationFunction · 0.45

Implementers 1

Componentpkg/component/component.go

Calls 2

ContainsMethod · 0.65
GetMethod · 0.65

Tested by 9

TestOAuthFlowFunction · 0.76
TestTokenExchangeFunction · 0.76
TestWebFunction · 0.76
TestGetGatewayFunction · 0.76
TestGetFrequencyPlanFunction · 0.76
TestApplicationServerFunction · 0.76
TestWebhooksFunction · 0.76
TestAuthenticationFunction · 0.76