File tree Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 55require (
66 github.com/bitrise-io/go-utils v1.0.1
77 github.com/gofrs/uuid v4.2.0+incompatible
8+ github.com/hashicorp/go-retryablehttp v0.7.1
89 github.com/mitchellh/mapstructure v1.4.3
910 github.com/stretchr/testify v1.7.0
1011 golang.org/x/sys v0.0.0-20220712014510-0a85c31ab51e
Original file line number Diff line number Diff line change @@ -10,8 +10,9 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n
1010github.com/hashicorp/go-cleanhttp v0.5.2 /go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48 =
1111github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI =
1212github.com/hashicorp/go-hclog v0.9.2 /go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ =
13- github.com/hashicorp/go-retryablehttp v0.7.0 h1:eu1EI/mbirUgP5C8hVsTNaGZreBDlYiwC1FZWkvQPQ4 =
1413github.com/hashicorp/go-retryablehttp v0.7.0 /go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY =
14+ github.com/hashicorp/go-retryablehttp v0.7.1 h1:sUiuQAnLlbvmExtFQs72iFW/HXeUn8Z1aJLQ4LJJbTQ =
15+ github.com/hashicorp/go-retryablehttp v0.7.1 /go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY =
1516github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs =
1617github.com/mitchellh/mapstructure v1.4.3 /go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo =
1718github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM =
Original file line number Diff line number Diff line change 1+ package retryhttp
2+
3+ import (
4+ "github.com/bitrise-io/go-utils/v2/log"
5+ "github.com/hashicorp/go-retryablehttp"
6+ )
7+
8+ // NewClient returns a retryable HTTP client with common defaults
9+ func NewClient (logger log.Logger ) * retryablehttp.Client {
10+ client := retryablehttp .NewClient ()
11+ client .Logger = & httpLogAdaptor {logger : logger }
12+ client .ErrorHandler = retryablehttp .PassthroughErrorHandler
13+
14+ return client
15+ }
16+
17+ // httpLogAdaptor adapts the retryablehttp.Logger interface to the go-utils logger.
18+ type httpLogAdaptor struct {
19+ logger log.Logger
20+ }
21+
22+ // Printf implements the retryablehttp.Logger interface
23+ func (a * httpLogAdaptor ) Printf (fmtStr string , vars ... interface {}) {
24+ a .logger .Debugf (fmtStr , vars ... )
25+ }
You can’t perform that action at this time.
0 commit comments