mirror of
https://github.com/ossf/scorecard.git
synced 2024-11-04 03:52:31 +03:00
✨ githubrepo: Allow providing an already authenticated transport (#1644)
This commit is contained in:
parent
cda7a1b1d4
commit
ba503c3bee
@ -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,
|
||||
}
|
||||
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user