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>
This commit is contained in:
Mara Furland
2026-04-16 23:36:00 +05:30
committed by Sanskar Jaiswal
parent 9f5c98cadc
commit e7375e5ee0
+3 -3
View File
@@ -73,14 +73,14 @@ func postMessage(address, token, proxy string, payload interface{}) error {
res, err := httpClient.Do(req.WithContext(ctx))
if err != nil {
return fmt.Errorf("sending notification failed: %w", err)
return fmt.Errorf("sending notification failed to send: %w", err)
}
defer res.Body.Close()
statusCode := res.StatusCode
if statusCode != 200 {
if statusCode < 200 || 300 <= statusCode {
body, _ := io.ReadAll(res.Body)
return fmt.Errorf("sending notification failed: %s", string(body))
return fmt.Errorf("sending notification bad response %d: %s", statusCode, string(body))
}
return nil