diff options
Diffstat (limited to 'modules/context/api.go')
-rw-r--r-- | modules/context/api.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/context/api.go b/modules/context/api.go index b6fcdd2a1c..574d7c4248 100644 --- a/modules/context/api.go +++ b/modules/context/api.go @@ -181,24 +181,24 @@ func (ctx *APIContext) SetLinkHeader(total, pageSize int) { links := genAPILinks(ctx.Req.URL, total, pageSize, ctx.FormInt("page")) if len(links) > 0 { - ctx.Header().Set("Link", strings.Join(links, ",")) + ctx.RespHeader().Set("Link", strings.Join(links, ",")) ctx.AppendAccessControlExposeHeaders("Link") } } // SetTotalCountHeader set "X-Total-Count" header func (ctx *APIContext) SetTotalCountHeader(total int64) { - ctx.Header().Set("X-Total-Count", fmt.Sprint(total)) + ctx.RespHeader().Set("X-Total-Count", fmt.Sprint(total)) ctx.AppendAccessControlExposeHeaders("X-Total-Count") } // AppendAccessControlExposeHeaders append headers by name to "Access-Control-Expose-Headers" header func (ctx *APIContext) AppendAccessControlExposeHeaders(names ...string) { - val := ctx.Header().Get("Access-Control-Expose-Headers") + val := ctx.RespHeader().Get("Access-Control-Expose-Headers") if len(val) != 0 { - ctx.Header().Set("Access-Control-Expose-Headers", fmt.Sprintf("%s, %s", val, strings.Join(names, ", "))) + ctx.RespHeader().Set("Access-Control-Expose-Headers", fmt.Sprintf("%s, %s", val, strings.Join(names, ", "))) } else { - ctx.Header().Set("Access-Control-Expose-Headers", strings.Join(names, ", ")) + ctx.RespHeader().Set("Access-Control-Expose-Headers", strings.Join(names, ", ")) } } |