MCPcopy Create free account
hub / github.com/google/go-cloud / NewHTTPClient

Function NewHTTPClient

gcp/gcp.go:58–70  ·  view source on GitHub ↗

NewHTTPClient creates a new authenticated HTTP client.

(transport http.RoundTripper, ts TokenSource)

Source from the content-addressed store, hash-verified

56
57// NewHTTPClient creates a new authenticated HTTP client.
58func NewHTTPClient(transport http.RoundTripper, ts TokenSource) (*HTTPClient, error) {
59 if ts == nil {
60 return nil, errors.New("gcp: no credentials available")
61 }
62 return &HTTPClient{
63 Client: http.Client{
64 Transport: &oauth2.Transport{
65 Base: transport,
66 Source: ts,
67 },
68 },
69 }, nil
70}
71
72// DefaultTransport returns http.DefaultTransport.
73func DefaultTransport() http.RoundTripper {

Callers 7

BenchmarkGcsblobFunction · 0.92
OpenBucketURLMethod · 0.92
ExampleOpenBucketFunction · 0.92
setupGCPFunction · 0.92
TestNewHTTPClientFunction · 0.92
OpenPostgresURLMethod · 0.92
OpenMySQLURLMethod · 0.92

Calls

no outgoing calls

Tested by 3

BenchmarkGcsblobFunction · 0.74
ExampleOpenBucketFunction · 0.74
TestNewHTTPClientFunction · 0.74