File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,9 @@ type Customization struct {
5757 BaseURL string
5858 // When true, talks a lot
5959 Verbose bool
60+ // HTTP Client to be used. Specifying this value will ignore the Timeout value set
61+ // Set your own timeout.
62+ Client * http.Client
6063
6164 // BeforeRequest runs before every client request, in the same goroutine.
6265 // May be used in rate limit.
@@ -70,10 +73,16 @@ type Customization struct {
7073// NewCustomized initialize a customized API client,
7174// useful when calling against etherscan-family API like BscScan.
7275func NewCustomized (config Customization ) * Client {
73- return & Client {
74- coon : & http.Client {
76+ var httpClient * http.Client
77+ if config .Client != nil {
78+ httpClient = config .Client
79+ } else {
80+ httpClient = & http.Client {
7581 Timeout : config .Timeout ,
76- },
82+ }
83+ }
84+ return & Client {
85+ coon : httpClient ,
7786 key : config .Key ,
7887 baseURL : config .BaseURL ,
7988 Verbose : config .Verbose ,
You can’t perform that action at this time.
0 commit comments