Skip to content

Commit

Permalink
accepted 2xx in response code as success
Browse files Browse the repository at this point in the history
  • Loading branch information
nasir-rabbani committed Oct 6, 2021
1 parent a400d98 commit ada2dbd
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/notifications/webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package webhook
import (
"encoding/json"
"fmt"
"net/http"

httputils "github.com/accurics/terrascan/pkg/utils/http"
"go.uber.org/zap"
Expand Down Expand Up @@ -79,7 +78,7 @@ func (w *Webhook) SendNotification(data interface{}) error {
}

// validate http response
if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated && resp.StatusCode != http.StatusAccepted {
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
zap.S().Errorf("failed to webhook notification. Incorrect status code: '%v'", resp.StatusCode)
return fmt.Errorf("webhook notification failed")
}
Expand Down

0 comments on commit ada2dbd

Please sign in to comment.