mirror of
https://github.com/thomiceli/opengist.git
synced 2026-06-23 04:10:18 +00:00
@@ -191,6 +191,7 @@ func GistJs(ctx *context.Context) error {
|
||||
if err != nil {
|
||||
return ctx.ErrorRes(500, "Error escaping JavaScript content", err)
|
||||
}
|
||||
ctx.Response().Header().Set("Cache-Control", "no-store")
|
||||
ctx.Response().Header().Set("Content-Type", "text/javascript")
|
||||
return ctx.PlainText(200, js)
|
||||
}
|
||||
|
||||
@@ -384,6 +384,13 @@ func TestGistJsSingleFile(t *testing.T) {
|
||||
assert.Contains(t, string(body), "prefers-color-scheme")
|
||||
})
|
||||
|
||||
t.Run("NoCacheHeader", func(t *testing.T) {
|
||||
_, _, username, identifier := s.CreateGist(t, "0")
|
||||
|
||||
resp := s.Request(t, "GET", "/"+username+"/"+identifier+".js", nil, 200)
|
||||
assert.Equal(t, "no-store", resp.Header.Get("Cache-Control"))
|
||||
})
|
||||
|
||||
t.Run("PrivateGist", func(t *testing.T) {
|
||||
_, _, username, identifier := s.CreateGist(t, "2")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user