Skip to content

Commit

Permalink
making this map a public variable
Browse files Browse the repository at this point in the history
Signed-off-by: dongjiang <[email protected]>
  • Loading branch information
dongjiang1989 committed Dec 24, 2024
1 parent 0a89b98 commit 7144e70
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions config/headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {},
Expand Down Expand Up @@ -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))
}
}
Expand Down
4 changes: 2 additions & 2 deletions config/headers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
}

0 comments on commit 7144e70

Please sign in to comment.