Allow 201 & 202 status code on webhooks

This commit is contained in:
Steven Wolfe 2019-02-05 14:49:01 -07:00
parent bfa35d5db9
commit 628e0882b8

View File

@ -57,8 +57,10 @@ func (conn *HTTPConn) Send(msg string) error {
if _, err := io.Copy(ioutil.Discard, resp.Body); err != nil { if _, err := io.Copy(ioutil.Discard, resp.Body); err != nil {
return err return err
} }
// we only care about the 200 response // Only allow responses with status code 200, 201, and 202
if resp.StatusCode != 200 { if resp.StatusCode != http.StatusOK &&
resp.StatusCode != http.StatusCreated &&
resp.StatusCode != http.StatusAccepted {
return fmt.Errorf("invalid status: %s", resp.Status) return fmt.Errorf("invalid status: %s", resp.Status)
} }
return nil return nil