Merge pull request #408 from tidwall/Allow-201-&-202-status-code-on-webhooks

Allow 201 & 202 status code on webhooks
This commit is contained in:
Josh Baker 2019-02-10 10:53:21 -07:00 committed by GitHub
commit 4cea3cc79b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

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