diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2021-09-13 10:13:32 -0600 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2021-09-13 10:13:32 -0600 |
commit | a437206643f35a84dea280c99e7e9555fc8df697 (patch) | |
tree | 85b88351a57485d049a83a074a575dbd97329f03 /modules/caddyhttp/headers/headers_test.go | |
parent | a779e1b38390205e8286a0578042646d858039a5 (diff) |
headers: Canonicalize case in replace (fix #4330)
Diffstat (limited to 'modules/caddyhttp/headers/headers_test.go')
-rw-r--r-- | modules/caddyhttp/headers/headers_test.go | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/modules/caddyhttp/headers/headers_test.go b/modules/caddyhttp/headers/headers_test.go index 11bdb0d..fb68225 100644 --- a/modules/caddyhttp/headers/headers_test.go +++ b/modules/caddyhttp/headers/headers_test.go @@ -160,6 +160,28 @@ func TestHandler(t *testing.T) { "Fail-5xx": []string{"true"}, }, }, + { + handler: Handler{ + Request: &HeaderOps{ + Replace: map[string][]Replacement{ + "Case-Insensitive": { + Replacement{ + Search: "issue4330", + Replace: "issue #4330", + }, + }, + }, + }, + }, + reqHeader: http.Header{ + "case-insensitive": []string{"issue4330"}, + "Other-Header": []string{"issue4330"}, + }, + expectedReqHeader: http.Header{ + "case-insensitive": []string{"issue #4330"}, + "Other-Header": []string{"issue4330"}, + }, + }, } { rr := httptest.NewRecorder() @@ -191,7 +213,7 @@ func TestHandler(t *testing.T) { }) if err := tc.handler.ServeHTTP(rr, req, next); err != nil { - t.Errorf("Test %d: %w", i, err) + t.Errorf("Test %d: %v", i, err) continue } |