Prometheus: Prevent duplicate registration of custom header middleware (#84860)

* remove dupe middleware

* fix test
This commit is contained in:
Will Browne 2024-03-20 20:22:33 +01:00 committed by GitHub
parent 00c094f7cf
commit c8c372c327
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1 additions and 2 deletions

View File

@ -37,7 +37,6 @@ func middlewares(logger log.Logger, httpMethod string) []sdkhttpclient.Middlewar
middlewares := []sdkhttpclient.Middleware{
// TODO: probably isn't needed anymore and should by done by http infra code
middleware.CustomQueryParameters(logger),
sdkhttpclient.CustomHeadersMiddleware(),
}
// Needed to control GET vs POST method of the requests

View File

@ -22,6 +22,6 @@ func TestCreateTransportOptions(t *testing.T) {
opts, err := CreateTransportOptions(context.Background(), settings, backend.NewLoggerWith("logger", "test"))
require.NoError(t, err)
require.Equal(t, http.Header{"Foo": []string{"bar"}}, opts.Header)
require.Equal(t, 2, len(opts.Middlewares))
require.Equal(t, 1, len(opts.Middlewares))
})
}