Remove accidental caching from repo list and other commands

Any gh command that has invoked NewCachedHTTPClient has also
inadvertently enabled caching for the original `http.Client` due to the
nature that NewCachedHTTPClient mutates the original argument passed.
This commit is contained in:
Mislav Marohnić 2022-07-14 19:10:32 +02:00
parent 7b7929bb6b
commit c22a85e2b5

View file

@ -60,8 +60,9 @@ func NewHTTPClient(opts HTTPClientOptions) (*http.Client, error) {
}
func NewCachedHTTPClient(httpClient *http.Client, ttl time.Duration) *http.Client {
httpClient.Transport = AddCacheTTLHeader(httpClient.Transport, ttl)
return httpClient
newClient := *httpClient
newClient.Transport = AddCacheTTLHeader(httpClient.Transport, ttl)
return &newClient
}
// AddCacheTTLHeader adds an header to the request telling the cache that the request