Resolve lint errors
Some checks failed
continuous-integration/drone/pr Build is failing

This commit is contained in:
Rounak Datta 2022-06-03 19:31:10 +05:30
parent d1a301fb3c
commit c9e67570ea
No known key found for this signature in database
GPG Key ID: A04E86FD28F5A421
2 changed files with 5 additions and 4 deletions

View File

@ -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),
} }

View File

@ -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
} }