Frontend service: Ensure we set Cache-Control header in the response (#113152)

ensure we set Cache-Control header in the response from frontend-service
This commit is contained in:
Ashley Harrison
2025-10-29 10:09:06 +00:00
committed by GitHub
parent c0ae0f437f
commit e75610ed03
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -153,6 +153,7 @@ func (p *IndexProvider) HandleRequest(writer http.ResponseWriter, request *http.
p.runIndexDataHooks(reqCtx, &data)
writer.Header().Set("Content-Type", "text/html; charset=UTF-8")
writer.Header().Set("Cache-Control", "no-store")
writer.WriteHeader(200)
if err := p.index.Execute(writer, &data); err != nil {
if errors.Is(err, syscall.EPIPE) { // Client has stopped listening.
+1
View File
@@ -92,6 +92,7 @@ func TestFrontendService_WebAssets(t *testing.T) {
assert.Equal(t, 200, recorder.Code)
assert.Contains(t, recorder.Header().Get("Content-Type"), "text/html")
assert.Contains(t, recorder.Header().Get("Cache-Control"), "no-store")
// The response should contain references to the assets
body := recorder.Body.String()