Prometheus: Small improvements to the custom client (#51709)

* Add suggestions

* Fix tests
This commit is contained in:
Andrej Ocenas
2022-07-04 22:55:07 +02:00
committed by GitHub
parent 9797744c10
commit bf334ab777
3 changed files with 19 additions and 6 deletions
+8 -1
View File
@@ -95,7 +95,14 @@ func TestService(t *testing.T) {
sender := &fakeSender{}
err := service.CallResource(context.Background(), req, sender)
require.NoError(t, err)
require.Equal(t, http.Header{"Content-Type": {"application/x-www-form-urlencoded"}, "foo": {"bar"}}, httpProvider.Roundtripper.Req.Header)
require.Equal(
t,
http.Header{
"Content-Type": {"application/x-www-form-urlencoded"},
"Idempotency-Key": []string(nil),
"foo": {"bar"},
},
httpProvider.Roundtripper.Req.Header)
require.Equal(t, http.MethodPost, httpProvider.Roundtripper.Req.Method)
body, err := io.ReadAll(httpProvider.Roundtripper.Req.Body)
require.NoError(t, err)