Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ githubrepo: Allow providing an already authenticated transport #1644

Merged
merged 1 commit into from
Feb 16, 2022
Merged
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
13 changes: 9 additions & 4 deletions clients/githubrepo/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,8 @@ func (client *Client) Close() error {
return client.tarball.cleanup()
}

// CreateGithubRepoClient returns a Client which implements RepoClient interface.
func CreateGithubRepoClient(ctx context.Context, logger *log.Logger) clients.RepoClient {
// Use our custom roundtripper
rt := roundtripper.NewTransport(ctx, logger)
// CreateGithubRepoClientWithTransport returns a Client which implements RepoClient interface.
func CreateGithubRepoClientWithTransport(ctx context.Context, rt http.RoundTripper) clients.RepoClient {
httpClient := &http.Client{
Transport: rt,
}
Expand Down Expand Up @@ -218,6 +216,13 @@ func CreateGithubRepoClient(ctx context.Context, logger *log.Logger) clients.Rep
}
}

// CreateGithubRepoClient returns a Client which implements RepoClient interface.
func CreateGithubRepoClient(ctx context.Context, logger *log.Logger) clients.RepoClient {
// Use our custom roundtripper
rt := roundtripper.NewTransport(ctx, logger)
return CreateGithubRepoClientWithTransport(ctx, rt)
}

// CreateOssFuzzRepoClient returns a RepoClient implementation
// intialized to `google/oss-fuzz` GitHub repository.
func CreateOssFuzzRepoClient(ctx context.Context, logger *log.Logger) (clients.RepoClient, error) {
Expand Down