mirror of
https://github.com/fluxcd/flagger.git
synced 2026-09-05 02:47:17 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user