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:
@@ -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.
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user