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

Function TestHeaderHTTPHeader

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

Source from the content-addressed store, hash-verified

58}
59
60func TestHeaderHTTPHeader(t *testing.T) {
61 testcases := map[string]struct {
62 header Header
63 expected http.Header
64 }{
65 "basic": {
66 header: Header{
67 "single": []Secret{"v1"},
68 "multi": []Secret{"v1", "v2"},
69 "empty": []Secret{},
70 "nil": nil,
71 },
72 expected: http.Header{
73 "single": []string{"v1"},
74 "multi": []string{"v1", "v2"},
75 "empty": []string{},
76 "nil": nil,
77 },
78 },
79 "nil": {
80 header: nil,
81 expected: nil,
82 },
83 }
84
85 for name, tc := range testcases {
86 t.Run(name, func(t *testing.T) {
87 actual := tc.header.HTTPHeader()
88 if !reflect.DeepEqual(actual, tc.expected) {
89 t.Fatalf("expecting: %#v, actual: %#v", tc.expected, actual)
90 }
91 })
92 }
93}
94
95func TestHeaderYamlUnmarshal(t *testing.T) {
96 testcases := map[string]struct {

Callers

nothing calls this directly

Calls 1

HTTPHeaderMethod · 0.80

Tested by

no test coverage detected