File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -244,9 +244,14 @@ func (e *HTTPError) Error() string {
244244 return e .err .Error ()
245245}
246246
247+ // HTTPClient interface is provided to be used instead of http.Client (e.g. to overload redirect/ retry policy)
248+ type HTTPClient interface {
249+ Do (req * http.Request ) (* http.Response , error )
250+ }
251+
247252type rpcClient struct {
248253 endpoint string
249- httpClient * http. Client
254+ httpClient HTTPClient
250255 customHeaders map [string ]string
251256 allowUnknownFields bool
252257 defaultRequestID int
@@ -260,7 +265,7 @@ type rpcClient struct {
260265//
261266// AllowUnknownFields: allows the rpc response to contain fields that are not defined in the rpc response specification.
262267type RPCClientOpts struct {
263- HTTPClient * http. Client
268+ HTTPClient HTTPClient
264269 CustomHeaders map [string ]string
265270 AllowUnknownFields bool
266271 DefaultRequestID int
You can’t perform that action at this time.
0 commit comments