This commit is contained in:
parent
d1a301fb3c
commit
c9e67570ea
|
@ -91,7 +91,7 @@ func notifyWebhook(notifiable Notifiable, notification Notification) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
webhookNotification := &WebhookNotification{
|
webhookNotification := &WebhookNotification{
|
||||||
endpointUrl: config.DatabasePassword.GetString(),
|
endpointURL: config.DatabasePassword.GetString(),
|
||||||
headers: map[string]string{}, // TODO: allow passing user-configurable headers
|
headers: map[string]string{}, // TODO: allow passing user-configurable headers
|
||||||
body: string(content),
|
body: string(content),
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,18 +18,19 @@ package notifications
|
||||||
|
|
||||||
// WebhookNotification represents a notification that published to a http endpoint
|
// WebhookNotification represents a notification that published to a http endpoint
|
||||||
type WebhookNotification struct {
|
type WebhookNotification struct {
|
||||||
endpointUrl string
|
endpointURL string
|
||||||
headers map[string]string
|
headers map[string]string
|
||||||
body string
|
body string
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendWebhook sends the notification to the configured endpoint
|
// SendWebhook sends the notification to the configured endpoint
|
||||||
func SendWebhook(w *WebhookNotification) error {
|
func SendWebhook(w *WebhookNotification) error {
|
||||||
_, err := DoPost(w.endpointUrl, w.body, w.headers)
|
resp, err := DoPost(w.endpointURL, w.body, w.headers)
|
||||||
// TODO: Have response-code basis exponential retries
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
// TODO: Have response-code based checks
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user