diff --git a/notify/webhook/webhook.go b/notify/webhook/webhook.go index 41241569ef..ce0eef3feb 100644 --- a/notify/webhook/webhook.go +++ b/notify/webhook/webhook.go @@ -18,7 +18,6 @@ import ( "context" "encoding/json" "fmt" - "io" "net/http" "os" "strings" @@ -55,11 +54,7 @@ func New(conf *config.WebhookConfig, t *template.Template, l log.Logger, httpOpt client: client, // Webhooks are assumed to respond with 2xx response codes on a successful // request and 5xx response codes are assumed to be recoverable. - retrier: ¬ify.Retrier{ - CustomDetailsFunc: func(_ int, body io.Reader) string { - return errDetails(body, conf.URL.String()) - }, - }, + retrier: ¬ify.Retrier{}, }, nil } @@ -126,14 +121,3 @@ func (n *Notifier) Notify(ctx context.Context, alerts ...*types.Alert) (bool, er } return shouldRetry, err } - -func errDetails(body io.Reader, url string) string { - if body == nil { - return url - } - bs, err := io.ReadAll(body) - if err != nil { - return url - } - return fmt.Sprintf("%s: %s", url, string(bs)) -} diff --git a/notify/webhook/webhook_test.go b/notify/webhook/webhook_test.go index 03f2592479..ede0840657 100644 --- a/notify/webhook/webhook_test.go +++ b/notify/webhook/webhook_test.go @@ -68,12 +68,12 @@ func TestWebhookRetry(t *testing.T) { `{"status":"invalid event"}`, )), - exp: fmt.Sprintf(`unexpected status code %d: %s: {"status":"invalid event"}`, http.StatusBadRequest, u.String()), + exp: fmt.Sprintf(`unexpected status code %d: {"status":"invalid event"}`, http.StatusBadRequest), }, { status: http.StatusBadRequest, - exp: fmt.Sprintf(`unexpected status code %d: %s`, http.StatusBadRequest, u.String()), + exp: fmt.Sprintf(`unexpected status code %d`, http.StatusBadRequest), }, } { t.Run("", func(t *testing.T) {