Skip to content

Commit

Permalink
Use uhttp.NewBaseHttpClientWithContext
Browse files Browse the repository at this point in the history
  • Loading branch information
ggreer committed Aug 7, 2024
1 parent 0729b13 commit 4341131
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 6 additions & 3 deletions pkg/bitbucket/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,15 @@ type Client struct {
workspaceIDs map[string]bool
}

func NewClient(httpClient *http.Client) *Client {
wrapper := uhttp.NewBaseHttpClient(httpClient)
func NewClient(ctx context.Context, httpClient *http.Client) (*Client, error) {
wrapper, err := uhttp.NewBaseHttpClientWithContext(ctx, httpClient)
if err != nil {
return nil, err
}

return &Client{
wrapper: wrapper,
}
}, nil
}

type LoginResponse struct {
Expand Down
6 changes: 5 additions & 1 deletion pkg/connector/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ func New(ctx context.Context, workspaces []string, auth uhttp.AuthCredentials) (
return nil, fmt.Errorf("bitbucket-connector: failed to get http client: %w", err)
}

client, err := bitbucket.NewClient(ctx, httpClient)
if err != nil {
return nil, err
}
return &Bitbucket{
client: bitbucket.NewClient(httpClient),
client: client,
workspaces: workspaces,
}, nil
}
Expand Down

0 comments on commit 4341131

Please sign in to comment.