Skip to content

Commit

Permalink
fix(panic) fix client push panic
Browse files Browse the repository at this point in the history
Check error of http request creation
  • Loading branch information
Stepan Pesternikov committed May 16, 2019
1 parent d5157a5 commit d1668c3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ func (c *Client) PushWithContext(ctx Context, n *Notification) (*Response, error
}

url := fmt.Sprintf("%v/3/device/%v", c.Host, n.DeviceToken)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(payload))
req, err := http.NewRequest("POST", url, bytes.NewBuffer(payload))
if err != nil {
return nil, err
}

if c.Token != nil {
c.setTokenHeader(req)
Expand Down

0 comments on commit d1668c3

Please sign in to comment.