commit 007a3d09eccd162b288c0584b68b0fdb83becf11 from: Oliver Lowe date: Mon Dec 27 12:07:33 2021 UTC Embed http.Client in Client No need to have it named commit - 2c4d16aea2e6138d88d6ecb7cec9d9af2e793593 commit + 007a3d09eccd162b288c0584b68b0fdb83becf11 blob - 0511d96326f694a7814290a8265fd08cf036609c blob + 7d82adcaf6357ddeada7d8d34d91598ff5c67b7e --- http.go +++ http.go @@ -56,16 +56,5 @@ func (c *Client) delete(path string, body io.Reader) ( func (c *Client) do(req *http.Request) (*http.Response, error) { req.SetBasicAuth(c.username, c.password) - return c.httpClient.Do(req) + return c.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 -} blob - 3b34af55df20ec80e209f19ad2f68158bb973e24 blob + 9b75770a31822ac754480e6116da1f931d3593f6 --- icinga.go +++ 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) {