Improve fail reasons, fix api crashes

- Add options about TLS verification
- Fix crashes when cachet presents IDs as a string
- Improve fail reasons
This commit is contained in:
Matej Kramny
2015-07-19 20:25:34 +01:00
parent 350244514a
commit 7a5ad278bb
6 changed files with 85 additions and 50 deletions

View File

@@ -2,6 +2,7 @@ package cachet
import (
"bytes"
"crypto/tls"
"io/ioutil"
"net/http"
)
@@ -13,6 +14,12 @@ func makeRequest(requestType string, url string, reqBody []byte) (*http.Response
req.Header.Set("X-Cachet-Token", Config.APIToken)
client := &http.Client{}
if Config.InsecureAPI == true {
client.Transport = &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
}
res, err := client.Do(req)
if err != nil {
return nil, []byte{}, err