From 8aae6e0d9a719f0cf55cce6ffe15435df68b96f5 Mon Sep 17 00:00:00 2001 From: Njegos Railic Date: Fri, 29 May 2020 12:20:13 +0200 Subject: [PATCH 1/2] Handle HTTP Status code 201 in the webhook sink --- pkg/sinks/webhook.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/sinks/webhook.go b/pkg/sinks/webhook.go index 9d287ce7..8c5d96b8 100644 --- a/pkg/sinks/webhook.go +++ b/pkg/sinks/webhook.go @@ -51,7 +51,7 @@ func (w *Webhook) Send(ctx context.Context, ev *kube.EnhancedEvent) error { body, err := ioutil.ReadAll(resp.Body) // TODO: make this prettier please - if resp.StatusCode != http.StatusOK { + if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated { return errors.New("not 200: " + string(body)) } From 80f904e39f1c626a6534f4d73a4e87b532070659 Mon Sep 17 00:00:00 2001 From: Njegos Railic Date: Fri, 29 May 2020 13:09:43 +0200 Subject: [PATCH 2/2] Update pkg/sinks/webhook.go Co-authored-by: Heinz N. Gies --- pkg/sinks/webhook.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/sinks/webhook.go b/pkg/sinks/webhook.go index 8c5d96b8..3488f687 100644 --- a/pkg/sinks/webhook.go +++ b/pkg/sinks/webhook.go @@ -52,7 +52,7 @@ func (w *Webhook) Send(ctx context.Context, ev *kube.EnhancedEvent) error { // TODO: make this prettier please if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated { - return errors.New("not 200: " + string(body)) + return errors.New("not 200/201: " + string(body)) } return nil