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 {
57
57
BaseURL string
58
58
// When true, talks a lot
59
59
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
60
63
61
64
// BeforeRequest runs before every client request, in the same goroutine.
62
65
// May be used in rate limit.
@@ -70,10 +73,16 @@ type Customization struct {
70
73
// NewCustomized initialize a customized API client,
71
74
// useful when calling against etherscan-family API like BscScan.
72
75
func 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 {
75
81
Timeout : config .Timeout ,
76
- },
82
+ }
83
+ }
84
+ return & Client {
85
+ coon : httpClient ,
77
86
key : config .Key ,
78
87
baseURL : config .BaseURL ,
79
88
Verbose : config .Verbose ,
You can’t perform that action at this time.
0 commit comments