Skip to content

Commit

Permalink
fix: print http error
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Sukhin <[email protected]>
  • Loading branch information
vsukhin committed Sep 27, 2024
1 parent 8707110 commit 80c2178
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/api/v1/client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func NewDirectAPIClient(httpClient *http.Client, sseClient *http.Client, apiURI,
CopyFileClient: NewCopyFileDirectClient(httpClient, apiURI, apiPathPrefix),
TemplateClient: NewTemplateClient(NewDirectClient[testkube.Template](httpClient, apiURI, apiPathPrefix)),
TestWorkflowClient: NewTestWorkflowClient(
NewDirectClient[testkube.TestWorkflow](httpClient, apiURI, apiPathPrefix),
NewDirectClient[testkube.TestWorkflow](httpClient, apiURI, apiPathPrefix).WithSSEClient(sseClient),
NewDirectClient[testkube.TestWorkflowWithExecution](httpClient, apiURI, apiPathPrefix),
NewDirectClient[testkube.TestWorkflowExecution](httpClient, apiURI, apiPathPrefix),
NewDirectClient[testkube.TestWorkflowExecutionsResult](httpClient, apiURI, apiPathPrefix),
Expand Down
11 changes: 11 additions & 0 deletions pkg/http/client.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package http

import (
"context"
"crypto/tls"
"fmt"
"net"
"net/http"
"time"
Expand Down Expand Up @@ -54,5 +56,14 @@ func NewSSEClient(insecure ...bool) *http.Client {
retryClient.RetryMax = MaxRetries
retryClient.HTTPClient.Timeout = time.Hour
retryClient.HTTPClient.Transport = netTransport
retryClient.CheckRetry = defaultRetryPolicy
return retryClient.StandardClient()
}

func defaultRetryPolicy(ctx context.Context, resp *http.Response, err error) (bool, error) {
if err != nil {
fmt.Println("http error", err)
return true, nil
}
return false, nil
}

0 comments on commit 80c2178

Please sign in to comment.