Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support http.Headers in util functions #3776

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

grobinson-grafana
Copy link
Contributor

This commit updates the util functions such as PostJSON to support additional headers using http.Header. It will mean integrations such as RocketChat can use the notify functions instead of http.NewRequest.

This commit updates the util functions such as PostJSON to support
additional headers using http.Header. It will mean integrations
such as RocketChat can use the notify functions instead of
http.NewRequest.

Signed-off-by: George Robinson <[email protected]>
Signed-off-by: George Robinson <[email protected]>
@grobinson-grafana grobinson-grafana marked this pull request as draft March 26, 2024 11:51
@grobinson-grafana grobinson-grafana marked this pull request as ready for review March 26, 2024 12:09
Signed-off-by: George Robinson <[email protected]>
@grobinson-grafana grobinson-grafana force-pushed the grobinson/support-http-headers-in-util branch from 239088b to 24bf56c Compare March 26, 2024 12:16
@@ -164,7 +164,7 @@ func (n *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error)
u.RawQuery = parameters.Encode()
// Don't log the URL as it contains secret data (see #1825).
level.Debug(n.logger).Log("msg", "Sending message", "incident", key)
resp, err := notify.PostText(ctx, n.client, u.String(), nil)
resp, err := notify.PostText(ctx, n.client, u.String(), nil, nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a lot of "nil" for a caller. What if one just passes the *http.Request to a function like notify.Do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants