From e6dd52b04c5852a51f6d1e012b3158d5ecb65202 Mon Sep 17 00:00:00 2001 From: hagen1778 Date: Mon, 18 Mar 2024 11:12:45 +0100 Subject: [PATCH] lib/promauth: follow-up b577413d3b3fa5241f2c1fac6e095ec31a7e312e Convert test result expectations to canonical form. Starting from https://github.com/VictoriaMetrics/VictoriaMetrics/commit/b577413d3b3fa5241f2c1fac6e095ec31a7e312e specified header keys are forced into canonical form https://pkg.go.dev/net/http#CanonicalHeaderKey Signed-off-by: hagen1778 --- docs/CHANGELOG.md | 1 + lib/promauth/config_test.go | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 46f699bdd..50434078c 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -31,6 +31,7 @@ See also [LTS releases](https://docs.victoriametrics.com/lts-releases/). ## tip **Update note 1: the `-datasource.lookback` command-line flag at `vmalert` is no-op starting from this release. This flag will be removed in the future, so please switch to [`eval_delay` option](https://docs.victoriametrics.com/vmalert/#groups). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5155) for more details.** +**Update note 2: transform custom HTTP header keys specified via [`headers` option](https://docs.victoriametrics.com/sd_configs/#http-api-client-options) for scrape targets to [canonical form](https://pkg.go.dev/net/http#CanonicalHeaderKey).** * SECURITY: upgrade Go builder from Go1.21.7 to Go1.22.1. See [the list of issues addressed in Go1.22.1](https://github.com/golang/go/issues?q=milestone%3AGo1.22.1+label%3ACherryPickApproved). diff --git a/lib/promauth/config_test.go b/lib/promauth/config_test.go index 0f51a223c..60441ee92 100644 --- a/lib/promauth/config_test.go +++ b/lib/promauth/config_test.go @@ -538,8 +538,8 @@ func TestParseHeadersSuccess(t *testing.T) { } } f(nil) - f([]string{"foo: bar"}) - f([]string{"Foo: bar", "A-b-c: d-e-f"}) + f([]string{"Foo: bar"}) + f([]string{"Foo: bar", "A-B-C: d-e-f"}) } func TestParseHeadersFailure(t *testing.T) { @@ -590,6 +590,6 @@ func TestConfigHeaders(t *testing.T) { } } f(nil, "") - f([]string{"foo: bar"}, "foo: bar\r\n") + f([]string{"foo: bar"}, "Foo: bar\r\n") f([]string{"Foo-Bar: Baz s:sdf", "A:b", "X-Forwarded-For: A-B:c"}, "Foo-Bar: Baz s:sdf\r\nA: b\r\nX-Forwarded-For: A-B:c\r\n") }