commit 007a3d09eccd162b288c0584b68b0fdb83becf11
parent 2c4d16aea2e6138d88d6ecb7cec9d9af2e793593
Author: Oliver Lowe <o@olowe.co>
Date: Mon, 27 Dec 2021 23:07:33 +1100
Embed http.Client in Client
No need to have it named
Diffstat:
2 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/http.go b/http.go
@@ -56,16 +56,5 @@ func (c *Client) delete(path string, body io.Reader) (*http.Response, error) {
func (c *Client) do(req *http.Request) (*http.Response, error) {
req.SetBasicAuth(c.username, c.password)
- return c.httpClient.Do(req)
-}
-
-// TODO
-type Result struct{}
-func results(resp *http.Response) (Result, error) {
- defer resp.Body.Close()
- var results []Result
- if err := json.NewDecoder(resp.Body).Decode(&results); err != nil {
- return Result{}, err
- }
- return Result{}, nil
+ return c.Do(req)
}
diff --git a/icinga.go b/icinga.go
@@ -9,7 +9,7 @@ type Client struct {
host string
username string
password string
- httpClient *http.Client
+ *http.Client
}
func Dial(host, username, password string, client *http.Client) (*Client, error) {