Skip to content

Commit

Permalink
Merge pull request #2 from Foxcool/patch-2
Browse files Browse the repository at this point in the history
Fix runtime error on v.client.Do()
  • Loading branch information
mileusna authored Jun 4, 2018
2 parents adce03a + 46ce29d commit 6ce1946
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions request.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ func (v *Viber) PostData(url string, i interface{}) ([]byte, error) {
req, err := http.NewRequest("POST", url, bytes.NewBuffer(b))
req.Header.Add("X-Viber-Auth-Token", v.AppKey)
req.Close = true

if v.client == nil {
v.client = &http.Client{}
}

resp, err := v.client.Do(req)
if err != nil {
Expand Down

0 comments on commit 6ce1946

Please sign in to comment.