From 57fc5fa402a5e8d4dc35b33572519179446c9d4a Mon Sep 17 00:00:00 2001 From: dongjiang Date: Tue, 24 Dec 2024 21:03:25 +0800 Subject: [PATCH] making this map a public variable Signed-off-by: dongjiang --- config/headers.go | 6 +++--- config/headers_test.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/headers.go b/config/headers.go index 7276742e..9beaae26 100644 --- a/config/headers.go +++ b/config/headers.go @@ -24,9 +24,9 @@ import ( "strings" ) -// reservedHeaders that change the connection, are set by Prometheus, or can +// ReservedHeaders that change the connection, are set by Prometheus, or can // be changed otherwise. -var reservedHeaders = map[string]struct{}{ +var ReservedHeaders = map[string]struct{}{ "Authorization": {}, "Host": {}, "Content-Encoding": {}, @@ -72,7 +72,7 @@ func (h *Headers) SetDirectory(dir string) { // Validate validates the Headers config. func (h *Headers) Validate() error { for n := range h.Headers { - if _, ok := reservedHeaders[http.CanonicalHeaderKey(n)]; ok { + if _, ok := ReservedHeaders[http.CanonicalHeaderKey(n)]; ok { return fmt.Errorf("setting header %q is not allowed", http.CanonicalHeaderKey(n)) } } diff --git a/config/headers_test.go b/config/headers_test.go index 39c6f9ff..c807fbc3 100644 --- a/config/headers_test.go +++ b/config/headers_test.go @@ -22,10 +22,10 @@ import ( ) func TestReservedHeaders(t *testing.T) { - for k := range reservedHeaders { + for k := range ReservedHeaders { l := http.CanonicalHeaderKey(k) if k != l { - t.Errorf("reservedHeaders keys should be lowercase: got %q, expected %q", k, http.CanonicalHeaderKey(k)) + t.Errorf("ReservedHeaders keys should be lowercase: got %q, expected %q", k, http.CanonicalHeaderKey(k)) } } }