Skip to content

Commit e7375e5

Browse files
mtfurlanaryan9600
authored andcommitted
fix(ms teams notifier): handle 202 status code
teams returns a 202 Accepted for webhooks, but flagger was marking this as an error. Signed-off-by: Mara Furland <mara@fur.land>
1 parent 9f5c98c commit e7375e5

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pkg/notifier/client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ func postMessage(address, token, proxy string, payload interface{}) error {
7373

7474
res, err := httpClient.Do(req.WithContext(ctx))
7575
if err != nil {
76-
return fmt.Errorf("sending notification failed: %w", err)
76+
return fmt.Errorf("sending notification failed to send: %w", err)
7777
}
7878

7979
defer res.Body.Close()
8080
statusCode := res.StatusCode
81-
if statusCode != 200 {
81+
if statusCode < 200 || 300 <= statusCode {
8282
body, _ := io.ReadAll(res.Body)
83-
return fmt.Errorf("sending notification failed: %s", string(body))
83+
return fmt.Errorf("sending notification bad response %d: %s", statusCode, string(body))
8484
}
8585

8686
return nil

0 commit comments

Comments
 (0)