NewHTTPClient creates a new authenticated HTTP client.
(transport http.RoundTripper, ts TokenSource)
| 56 | |
| 57 | // NewHTTPClient creates a new authenticated HTTP client. |
| 58 | func 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. |
| 73 | func DefaultTransport() http.RoundTripper { |
no outgoing calls