MCPcopy Index your code
hub / github.com/cortexproject/cortex / TestNewApiWithHeaderLogging

Function TestNewApiWithHeaderLogging

pkg/api/api_test.go:75–90  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

73}
74
75func TestNewApiWithHeaderLogging(t *testing.T) {
76 cfg := Config{
77 HTTPRequestHeadersToLog: []string{"ForTesting"},
78 }
79 serverCfg := server.Config{
80 HTTPListenNetwork: server.DefaultNetwork,
81 MetricsNamespace: "with_header_logging",
82 }
83 server, err := server.New(serverCfg)
84 require.NoError(t, err)
85
86 api, err := New(cfg, serverCfg, server, &FakeLogger{})
87 require.NoError(t, err)
88 require.NotNil(t, api.HTTPHeaderMiddleware)
89
90}
91
92// HTTPHeaderMiddleware should be added even if no headers are specified to log because it also handles request ID injection.
93func TestNewApiWithoutHeaderLogging(t *testing.T) {

Callers

nothing calls this directly

Calls 1

NewFunction · 0.70

Tested by

no test coverage detected