prysm-pulse/beacon-chain/powchain/engine-api-client/v1/options.go

30 lines
501 B
Go

package v1
import (
"net/http"
)
// Option for configuring the engine API client.
type Option func(c *Client) error
type config struct {
httpClient *http.Client
}
func defaultConfig() *config {
return &config{
httpClient: &http.Client{
Timeout: DefaultTimeout,
},
}
}
// WithHTTPClient allows setting a custom HTTP client
// for the API connection.
func WithHTTPClient(httpClient *http.Client) Option {
return func(c *Client) error {
c.cfg.httpClient = httpClient
return nil
}
}