Skip to content

Commit 69cafb5

Browse files
hcsa73Henrique Santos
andauthored
Make do public (#164)
* Make do public * Add comment --------- Co-authored-by: Henrique Santos <[email protected]>
1 parent 6e5b545 commit 69cafb5

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

core/clients/clients.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ func NewRetryConfig() *RetryConfig {
4646
}
4747
}
4848

49-
// do performs the request
50-
func do(client *http.Client, req *http.Request, cfg *RetryConfig) (resp *http.Response, err error) {
49+
// Do performs the request, retrying according to the configurations provided
50+
func Do(client *http.Client, req *http.Request, cfg *RetryConfig) (resp *http.Response, err error) {
5151
if cfg == nil {
5252
cfg = NewRetryConfig()
5353
}

core/clients/clients_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func TestDo(t *testing.T) {
8686
if tt.name == "all ok nil client" {
8787
c = nil
8888
}
89-
gotResp, err := do(c, req, tt.args.cfg)
89+
gotResp, err := Do(c, req, tt.args.cfg)
9090
if err == nil {
9191
// Defer discard and close the body
9292
defer func() {

core/clients/key_flow.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func (c *KeyFlow) GetToken() TokenResponseBody {
107107
func (c *KeyFlow) Init(cfg *KeyFlowConfig) error {
108108
c.token = &TokenResponseBody{}
109109
c.config = cfg
110-
c.doer = do
110+
c.doer = Do
111111
if c.config.TokenUrl == "" {
112112
tokenCustomUrl, tokenUrlSet := os.LookupEnv("STACKIT_TOKEN_BASEURL")
113113
if !tokenUrlSet || tokenCustomUrl == "" {

core/clients/key_flow_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func TestKeyFlowValidateToken(t *testing.T) {
153153
PrivateKey: string(privateKey),
154154
JWKSUrl: jwksAPI,
155155
},
156-
doer: do,
156+
doer: Do,
157157
}
158158
got, err := c.validateToken(tt.token)
159159
if (err != nil) != tt.wantErr {

core/clients/no_auth_flow.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ func (c *NoAuthFlow) RoundTrip(req *http.Request) (*http.Response, error) {
5252
if c.client == nil {
5353
return nil, fmt.Errorf("please run Init()")
5454
}
55-
return do(c.client, req, c.config.ClientRetry)
55+
return Do(c.client, req, c.config.ClientRetry)
5656
}

core/clients/token_flow.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,5 @@ func (c *TokenFlow) RoundTrip(req *http.Request) (*http.Response, error) {
7878
if c.client == nil {
7979
return nil, fmt.Errorf("please run Init()")
8080
}
81-
return do(c.client, req, c.config.ClientRetry)
81+
return Do(c.client, req, c.config.ClientRetry)
8282
}

0 commit comments

Comments
 (0)