Skip to content

Commit

Permalink
Use sdk client in notify.
Browse files Browse the repository at this point in the history
  • Loading branch information
flowerinthenight committed Oct 5, 2017
1 parent 085f56e commit 4a1f28f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/notification/httpnotify.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"net/http"

"github.com/mobingilabs/mobingi-sdk-go/client"
"github.com/pkg/errors"
)

Expand All @@ -12,10 +13,10 @@ type simpleHttpNotify struct {
}

func (h *simpleHttpNotify) Notify(payload []byte) error {
client := &http.Client{}
c := client.NewSimpleHttpClient()
req, err := http.NewRequest(http.MethodPost, h.Endpoint, bytes.NewBuffer(payload))
req.Header.Add("Content-Type", "application/json")
_, err = client.Do(req)
_, _, err = c.Do(req)
if err != nil {
return errors.Wrap(err, "notify "+h.Endpoint+" failed")
}
Expand Down

0 comments on commit 4a1f28f

Please sign in to comment.