This repository has been archived on 2021-12-17. You can view files and clone it, but cannot push or open issues/pull-requests.
falseknees/client.go

30 lines
519 B
Go

package falseknees
import "net/http"
// Client is a FalseKnees client
type Client struct {
http *http.Client
}
// New returns a new Client
func New(opts ...ClientOption) *Client {
c := &Client{
http: http.DefaultClient,
}
for _, opt := range opts {
opt(c)
}
return c
}
// ClientOption is options for a Client
type ClientOption func(*Client)
// WithHTTP is a ClientOption for using a different http.Client
func WithHTTP(client *http.Client) ClientOption {
return func(c *Client) {
c.http = client
}
}