diff --git a/request.go b/request.go index dbdf888..5a7579a 100644 --- a/request.go +++ b/request.go @@ -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 {