Skip to content

Commit

Permalink
Merge branch 'Yleisradio-ineffectual_err'
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafaakin committed Jul 6, 2023
2 parents f8f0f01 + ff36eee commit 5814d29
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/sinks/teams.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ func (w *Teams) Send(ctx context.Context, ev *kube.EnhancedEvent) error {
"summary": "event",
"text": string([]byte(output)),
})
if err != nil {
return err
}

req, err := http.NewRequest(http.MethodPost, w.cfg.Endpoint, bytes.NewReader(reqBody))
if err != nil {
Expand All @@ -63,6 +66,10 @@ func (w *Teams) Send(ctx context.Context, ev *kube.EnhancedEvent) error {
body, err := io.ReadAll(resp.Body)
message := string(body)

if err != nil {
return err
}

if resp.StatusCode != http.StatusOK {
return fmt.Errorf("not 200: %s", message)
}
Expand Down

0 comments on commit 5814d29

Please sign in to comment.