Fix panic when the webhook fails (xmpp) (#1401)

This commit is contained in:
Alexander 2021-02-15 22:18:30 +01:00 committed by GitHub
parent 858cdc86f5
commit ce5140febd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -158,8 +158,13 @@ func (b *Bxmpp) postSlackCompatibleWebhook(msg config.Message) error {
} }
resp, err := http.Post(b.GetString("WebhookURL")+"/"+msg.Channel, "application/json", bytes.NewReader(webhookBody)) resp, err := http.Post(b.GetString("WebhookURL")+"/"+msg.Channel, "application/json", bytes.NewReader(webhookBody))
if err != nil {
b.Log.Errorf("Failed to POST webhook: %s", err)
return err
}
resp.Body.Close() resp.Body.Close()
return err return nil
} }
func (b *Bxmpp) createXMPP() error { func (b *Bxmpp) createXMPP() error {