Skip to content
This repository has been archived by the owner on Feb 26, 2023. It is now read-only.

Commit

Permalink
Add option to specify http client
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyaglow committed Jun 25, 2019
1 parent 659aa8b commit afe9b69
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cortex.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ type Client struct {
Users UserService
}

// ClientOpts represent options that are passed to client
// ClientOpts represent options that are passed to client.
type ClientOpts struct {
Auth auth
Auth auth
HTTPClient *http.Client
}

// errorMessage is the message that Cortex sends back to user when something
Expand All @@ -105,8 +106,12 @@ func NewClient(baseurl string, opts *ClientOpts) (*Client, error) {
return nil, err
}

if opts.HTTPClient != nil {
opts.HTTPClient = http.DefaultClient
}

c := &Client{
Client: http.DefaultClient,
Client: opts.HTTPClient,
BaseURL: u,
UserAgent: userAgent,
Opts: opts,
Expand Down

0 comments on commit afe9b69

Please sign in to comment.