diff --git a/githubapp/client_creator.go b/githubapp/client_creator.go index ca45b87f..5c91c70f 100644 --- a/githubapp/client_creator.go +++ b/githubapp/client_creator.go @@ -399,7 +399,7 @@ func noStoreServerErrors(next http.RoundTripper) http.RoundTripper { // Preserve existing Cache-Control directives. cacheControl := resp.Header.Get("Cache-Control") // Don't add a no-store directive if it already exists. - for _, directive := range strings.Split(cacheControl, ",") { + for directive := range strings.SplitSeq(cacheControl, ",") { if strings.TrimSpace(directive) == "no-store" { return resp, err } diff --git a/githubapp/client_creator_test.go b/githubapp/client_creator_test.go index e2c5adf7..0c847e00 100644 --- a/githubapp/client_creator_test.go +++ b/githubapp/client_creator_test.go @@ -16,6 +16,7 @@ package githubapp import ( "io" + "maps" "net/http" "net/http/httptest" "testing" @@ -121,9 +122,7 @@ type cacheTestResponse struct { func newCacheTestResponse(status int, header http.Header) *http.Response { recorder := httptest.NewRecorder() - for key, values := range header { - recorder.Header()[key] = values - } + maps.Copy(recorder.Header(), header) recorder.WriteHeader(status) return recorder.Result() }