Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/clients/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ func NewRetryConfig() *RetryConfig {
}
}

// do performs the request
func do(client *http.Client, req *http.Request, cfg *RetryConfig) (resp *http.Response, err error) {
// Do performs the request, retrying according to the configurations provided
func Do(client *http.Client, req *http.Request, cfg *RetryConfig) (resp *http.Response, err error) {
if cfg == nil {
cfg = NewRetryConfig()
}
Expand Down
2 changes: 1 addition & 1 deletion core/clients/clients_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func TestDo(t *testing.T) {
if tt.name == "all ok nil client" {
c = nil
}
gotResp, err := do(c, req, tt.args.cfg)
gotResp, err := Do(c, req, tt.args.cfg)
if err == nil {
// Defer discard and close the body
defer func() {
Expand Down
2 changes: 1 addition & 1 deletion core/clients/key_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (c *KeyFlow) GetToken() TokenResponseBody {
func (c *KeyFlow) Init(cfg *KeyFlowConfig) error {
c.token = &TokenResponseBody{}
c.config = cfg
c.doer = do
c.doer = Do
if c.config.TokenUrl == "" {
tokenCustomUrl, tokenUrlSet := os.LookupEnv("STACKIT_TOKEN_BASEURL")
if !tokenUrlSet || tokenCustomUrl == "" {
Expand Down
2 changes: 1 addition & 1 deletion core/clients/key_flow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func TestKeyFlowValidateToken(t *testing.T) {
PrivateKey: string(privateKey),
JWKSUrl: jwksAPI,
},
doer: do,
doer: Do,
}
got, err := c.validateToken(tt.token)
if (err != nil) != tt.wantErr {
Expand Down
2 changes: 1 addition & 1 deletion core/clients/no_auth_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ func (c *NoAuthFlow) RoundTrip(req *http.Request) (*http.Response, error) {
if c.client == nil {
return nil, fmt.Errorf("please run Init()")
}
return do(c.client, req, c.config.ClientRetry)
return Do(c.client, req, c.config.ClientRetry)
}
2 changes: 1 addition & 1 deletion core/clients/token_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ func (c *TokenFlow) RoundTrip(req *http.Request) (*http.Response, error) {
if c.client == nil {
return nil, fmt.Errorf("please run Init()")
}
return do(c.client, req, c.config.ClientRetry)
return Do(c.client, req, c.config.ClientRetry)
}