AddCacheTTLHeader adds a header to the request telling the cache that the request should be cached for a specified amount of time.
(rt http.RoundTripper, ttl time.Duration)
| 171 | // AddCacheTTLHeader adds a header to the request telling the cache that the request |
| 172 | // should be cached for a specified amount of time. |
| 173 | func AddCacheTTLHeader(rt http.RoundTripper, ttl time.Duration) http.RoundTripper { |
| 174 | return &funcTripper{roundTrip: func(req *http.Request) (*http.Response, error) { |
| 175 | // If the header is already set in the request, don't overwrite it. |
| 176 | if req.Header.Get(cacheTTL) == "" { |
| 177 | req.Header.Set(cacheTTL, ttl.String()) |
| 178 | } |
| 179 | return rt.RoundTrip(req) |
| 180 | }} |
| 181 | } |
| 182 | |
| 183 | // AddAuthTokenHeader adds an authentication token header for the host specified by the request, using the primitive |
| 184 | // token source. It is the backward-compatible entry point retained for external callers of this package; gh's own code |
no test coverage detected