Commit ce055108 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Merge branch 'drop-overriding-cache-control-for-archives' into 'master'

Don't set Cache-Control header for git archives

See merge request gitlab-org/gitlab-workhorse!462
parents 3d35bee2 c662df40
......@@ -166,7 +166,6 @@ func setArchiveHeaders(w http.ResponseWriter, format gitalypb.GetArchiveRequest_
w.Header().Set("Content-Type", "application/octet-stream")
}
w.Header().Set("Content-Transfer-Encoding", "binary")
w.Header().Set("Cache-Control", "private")
}
func prepareArchiveTempfile(dir string, prefix string) (*os.File, error) {
......
......@@ -67,13 +67,15 @@ func TestSetArchiveHeaders(t *testing.T) {
w.Header().Set("Content-Type", "test")
w.Header().Set("Content-Length", "test")
w.Header().Set("Content-Disposition", "test")
w.Header().Set("Cache-Control", "test")
// This should be preserved
w.Header().Set("Cache-Control", "public, max-age=3600")
setArchiveHeaders(w, testCase.in, "filename")
testhelper.AssertResponseWriterHeader(t, w, "Content-Type", testCase.out)
testhelper.AssertResponseWriterHeader(t, w, "Content-Length")
testhelper.AssertResponseWriterHeader(t, w, "Content-Disposition", `attachment; filename="filename"`)
testhelper.AssertResponseWriterHeader(t, w, "Cache-Control", "private")
testhelper.AssertResponseWriterHeader(t, w, "Cache-Control", "public, max-age=3600")
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment