diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2021-12-15 14:59:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-15 14:59:57 +0800 |
commit | 4da1d9781025aa4a85899b1ddeb25aabbaa82703 (patch) | |
tree | 9714f71f2fb042e44d418fbcfc56cd8440a1bbb1 /routers/api/v1/repo/commits.go | |
parent | 9d943bf374e56e4d403303a6a2caafc1c79cdb6f (diff) | |
download | gitea-4da1d9781025aa4a85899b1ddeb25aabbaa82703.tar.gz gitea-4da1d9781025aa4a85899b1ddeb25aabbaa82703.zip |
Refactor HTTP request context (#17979)
Diffstat (limited to 'routers/api/v1/repo/commits.go')
-rw-r--r-- | routers/api/v1/repo/commits.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/routers/api/v1/repo/commits.go b/routers/api/v1/repo/commits.go index 117fef08da..6845ccb363 100644 --- a/routers/api/v1/repo/commits.go +++ b/routers/api/v1/repo/commits.go @@ -205,11 +205,11 @@ func GetAllCommits(ctx *context.APIContext) { ctx.SetTotalCountHeader(commitsCountTotal) // kept for backwards compatibility - ctx.Header().Set("X-Page", strconv.Itoa(listOptions.Page)) - ctx.Header().Set("X-PerPage", strconv.Itoa(listOptions.PageSize)) - ctx.Header().Set("X-Total", strconv.FormatInt(commitsCountTotal, 10)) - ctx.Header().Set("X-PageCount", strconv.Itoa(pageCount)) - ctx.Header().Set("X-HasMore", strconv.FormatBool(listOptions.Page < pageCount)) + ctx.RespHeader().Set("X-Page", strconv.Itoa(listOptions.Page)) + ctx.RespHeader().Set("X-PerPage", strconv.Itoa(listOptions.PageSize)) + ctx.RespHeader().Set("X-Total", strconv.FormatInt(commitsCountTotal, 10)) + ctx.RespHeader().Set("X-PageCount", strconv.Itoa(pageCount)) + ctx.RespHeader().Set("X-HasMore", strconv.FormatBool(listOptions.Page < pageCount)) ctx.AppendAccessControlExposeHeaders("X-Page", "X-PerPage", "X-Total", "X-PageCount", "X-HasMore") ctx.JSON(http.StatusOK, &apiCommits) |