From 650c6ee8fb9109a664a3305672683caf34c7e631 Mon Sep 17 00:00:00 2001 From: Bala FA Date: Wed, 11 Apr 2018 06:15:54 +0530 Subject: [PATCH] event/target/webhook: treat all 2xx as success. (#5792) Fixes #5769 --- pkg/event/target/webhook.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/event/target/webhook.go b/pkg/event/target/webhook.go index 1a9897a96..ad4ca3aa7 100644 --- a/pkg/event/target/webhook.go +++ b/pkg/event/target/webhook.go @@ -79,12 +79,11 @@ func (target *WebhookTarget) Send(eventData event.Event) error { // FIXME: log returned error. ignore time being. _ = resp.Body.Close() - switch resp.StatusCode { - case http.StatusOK, http.StatusAccepted, http.StatusContinue: - return nil - default: + if resp.StatusCode < 200 || resp.StatusCode > 299 { return fmt.Errorf("sending event failed with %v", resp.Status) } + + return nil } // Close - does nothing and available for interface compatibility.