aboutsummaryrefslogtreecommitdiffstats
path: root/modules/context
diff options
context:
space:
mode:
authorYarden Shoham <hrsi88@gmail.com>2023-03-08 22:40:04 +0200
committerGitHub <noreply@github.com>2023-03-08 15:40:04 -0500
commitaf0468ed8dea62f373c51efaa679080a9cb69f5c (patch)
tree872b1ecb010503d74236c04e95aa78badba5d9d4 /modules/context
parent1960ad5c90df65100488b64e7047d1ba3096c11c (diff)
downloadgitea-af0468ed8dea62f373c51efaa679080a9cb69f5c.tar.gz
gitea-af0468ed8dea62f373c51efaa679080a9cb69f5c.zip
Set `X-Gitea-Debug` header once (#23361)
Instead of adding it # Before On the raw commit page: ![image](https://user-images.githubusercontent.com/20454870/223470744-cdf11898-e023-4198-8c8b-c294e5d78b73.png) # After ![image](https://user-images.githubusercontent.com/20454870/223470596-af898d66-bd5b-4ddb-b220-ceb1f149bfec.png) Fixes #23308 --------- Signed-off-by: Yarden Shoham <hrsi88@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Diffstat (limited to 'modules/context')
-rw-r--r--modules/context/api.go2
-rw-r--r--modules/context/context.go4
2 files changed, 3 insertions, 3 deletions
diff --git a/modules/context/api.go b/modules/context/api.go
index 3f938948ae..f7a3384691 100644
--- a/modules/context/api.go
+++ b/modules/context/api.go
@@ -244,7 +244,7 @@ func APIContexter() func(http.Handler) http.Handler {
}
}
- httpcache.AddCacheControlToHeader(ctx.Resp.Header(), 0, "no-transform")
+ httpcache.SetCacheControlInHeader(ctx.Resp.Header(), 0, "no-transform")
ctx.Resp.Header().Set(`X-Frame-Options`, setting.CORSConfig.XFrameOptions)
ctx.Data["Context"] = &ctx
diff --git a/modules/context/context.go b/modules/context/context.go
index 0c8d7411ed..50c34edae2 100644
--- a/modules/context/context.go
+++ b/modules/context/context.go
@@ -388,7 +388,7 @@ func (ctx *Context) SetServeHeaders(opts *ServeHeaderOptions) {
if duration == 0 {
duration = 5 * time.Minute
}
- httpcache.AddCacheControlToHeader(header, duration)
+ httpcache.SetCacheControlInHeader(header, duration)
if !opts.LastModified.IsZero() {
header.Set("Last-Modified", opts.LastModified.UTC().Format(http.TimeFormat))
@@ -753,7 +753,7 @@ func Contexter(ctx context.Context) func(next http.Handler) http.Handler {
}
}
- httpcache.AddCacheControlToHeader(ctx.Resp.Header(), 0, "no-transform")
+ httpcache.SetCacheControlInHeader(ctx.Resp.Header(), 0, "no-transform")
ctx.Resp.Header().Set(`X-Frame-Options`, setting.CORSConfig.XFrameOptions)
ctx.Data["CsrfToken"] = ctx.csrf.GetToken()