MCPcopy Create free account
hub / github.com/prometheus/common / TestHeaderHTTPHeader

Function TestHeaderHTTPHeader

config/config_test.go:81–112  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

79}
80
81func TestHeaderHTTPHeader(t *testing.T) {
82 testcases := map[string]struct {
83 header ProxyHeader
84 expected http.Header
85 }{
86 "basic": {
87 header: ProxyHeader{
88 "single": []Secret{"v1"},
89 "multi": []Secret{"v1", "v2"},
90 "empty": []Secret{},
91 "nil": nil,
92 },
93 expected: http.Header{
94 "single": []string{"v1"},
95 "multi": []string{"v1", "v2"},
96 "empty": []string{},
97 "nil": nil,
98 },
99 },
100 "nil": {
101 header: nil,
102 expected: nil,
103 },
104 }
105
106 for name, tc := range testcases {
107 t.Run(name, func(t *testing.T) {
108 actual := tc.header.HTTPHeader()
109 require.Truef(t, reflect.DeepEqual(actual, tc.expected), "expecting: %#v, actual: %#v", tc.expected, actual)
110 })
111 }
112}
113
114func TestHeaderYamlUnmarshal(t *testing.T) {
115 testcases := map[string]struct {

Callers

nothing calls this directly

Calls 1

HTTPHeaderMethod · 0.80

Tested by

no test coverage detected