Skip to content

Commit

Permalink
Using cloned transport in retryClient (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
bendbennett committed Feb 2, 2023
1 parent 74aaad5 commit ee6b971
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions internal/provider/data_source_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,6 @@ func (d *httpDataSource) Read(ctx context.Context, req datasource.ReadRequest, r
clonedTr.TLSClientConfig.RootCAs = caCertPool
}

client := &http.Client{
Transport: clonedTr,
}

var retry retryModel

if !model.Retry.IsNull() && !model.Retry.IsUnknown() {
Expand All @@ -248,8 +244,7 @@ func (d *httpDataSource) Read(ctx context.Context, req datasource.ReadRequest, r
}

retryClient := retryablehttp.NewClient()
// TODO: Can we just assign the transport rather than the client?
retryClient.HTTPClient = client
retryClient.HTTPClient.Transport = clonedTr
retryClient.Logger = levelledLogger{ctx}
retryClient.RetryMax = int(retry.Attempts.ValueInt64())
retryClient.CheckRetry = func(ctx context.Context, resp *http.Response, err error) (bool, error) {
Expand Down

0 comments on commit ee6b971

Please sign in to comment.