Files
traces/modules/frontend/handler_test.go
aa8307e7e2 chore: add query-frontend option to select request headers in query logs (#3383)
* chore: add query-frontend option to select request headers in query logs

* chore: added changelog entry

* Update modules/frontend/handler.go

Co-authored-by: Mario <[email protected]>

* Update modules/frontend/handler.go

Co-authored-by: Mario <[email protected]>

* chore: fix typo in a name

---------

Co-authored-by: Mario <[email protected]>
2024-02-26 12:14:14 +01:00

24 lines
478 B
Go

package frontend
import (
"net/http"
"testing"
"github.com/stretchr/testify/require"
)
func TestFormatRequestHeaders(t *testing.T) {
h := http.Header{}
h.Add("X-Header-To-Log", "i should be logged!")
h.Add("X-Header-To-Not-Log", "i shouldn't be logged!")
fields := formatRequestHeaders(&h, []string{"X-Header-To-Log", "X-Header-Not-Present"})
expected := []interface{}{
"header_x_header_to_log",
"i should be logged!",
}
require.Equal(t, expected, fields)
}