pull/78/head
Hunter Long 2018-10-06 22:05:53 -07:00
parent 2f3c9a2884
commit 0a55ae08c9
3 changed files with 7 additions and 0 deletions

View File

@ -137,6 +137,7 @@ func TestNotification_Update(t *testing.T) {
func TestEnableNotification(t *testing.T) {
notifier, err := SelectNotification(example)
assert.Nil(t, err)
notifier.Enabled = true
updated, err := Update(example, notifier)
assert.Nil(t, err)

View File

@ -62,6 +62,9 @@ func (u *lineNotifier) Send(msg interface{}) error {
v := url.Values{}
v.Set("message", message)
req, err := http.NewRequest("POST", "https://notify-api.line.me/api/notify", strings.NewReader(v.Encode()))
if err != nil {
return err
}
req.Header.Add("Authorization", fmt.Sprintf("Bearer %v", u.GetValue("api_secret")))
req.Header.Add("Accept", "application/json")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

View File

@ -90,6 +90,9 @@ func (u *twilio) Send(msg interface{}) error {
v.Set("Body", message)
rb := *strings.NewReader(v.Encode())
req, err := http.NewRequest("POST", twilioUrl, &rb)
if err != nil {
return err
}
req.SetBasicAuth(u.ApiKey, u.ApiSecret)
req.Header.Add("Accept", "application/json")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")