Export: Remove no-store headers in pdf and image previews (#78844)

This commit is contained in:
Ezequiel Victorero
2023-12-18 09:21:57 -03:00
committed by GitHub
parent 10cc3321cd
commit 864d91ed3e
3 changed files with 20 additions and 1 deletions
+16
View File
@@ -190,6 +190,22 @@ func TestMiddlewareContext(t *testing.T) {
"X-Other-Header": "other-test",
}
})
middlewareScenario(t, "middleware should not add Cache-Control header for requests to render pdf", func(
t *testing.T, sc *scenarioContext) {
sc.fakeReq("GET", "/api/reports/render/pdf/").exec()
assert.Empty(t, sc.resp.Header().Get("Cache-Control"))
assert.Empty(t, sc.resp.Header().Get("Pragma"))
assert.Empty(t, sc.resp.Header().Get("Expires"))
})
middlewareScenario(t, "middleware should not add Cache-Control header for requests to render panel as image", func(
t *testing.T, sc *scenarioContext) {
sc.fakeReq("GET", "/render/d-solo/").exec()
assert.Empty(t, sc.resp.Header().Get("Cache-Control"))
assert.Empty(t, sc.resp.Header().Get("Pragma"))
assert.Empty(t, sc.resp.Header().Get("Expires"))
})
}
func middlewareScenario(t *testing.T, desc string, fn scenarioFunc, cbs ...func(*setting.Cfg)) {