Function
newCAPITransport
(token string, capiBaseURL string, rp http.RoundTripper)
Source from the content-addressed store, hash-verified
| 50 | } |
| 51 | |
| 52 | func newCAPITransport(token string, capiBaseURL string, rp http.RoundTripper) *capiTransport { |
| 53 | capiHost := "" |
| 54 | if u, err := url.Parse(capiBaseURL); err == nil { |
| 55 | capiHost = u.Host |
| 56 | } |
| 57 | return &capiTransport{ |
| 58 | rp: rp, |
| 59 | token: token, |
| 60 | capiHost: capiHost, |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | func (ct *capiTransport) RoundTrip(req *http.Request) (*http.Response, error) { |
| 65 | req.Header.Set("Authorization", "Bearer "+ct.token) |
Tested by
no test coverage detected