aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/issue.go
diff options
context:
space:
mode:
authorCirno the Strongest <1447794+CirnoT@users.noreply.github.com>2020-06-21 10:22:06 +0200
committerGitHub <noreply@github.com>2020-06-21 16:22:06 +0800
commit81324cf37c87d834137a3b5ebf287adeed513f18 (patch)
tree918aa8464f8cbecd502105d98ec22d6062232533 /routers/api/v1/repo/issue.go
parenta07cc0df76056ce2be1d8a89f38416cf511dd03b (diff)
downloadgitea-81324cf37c87d834137a3b5ebf287adeed513f18.tar.gz
gitea-81324cf37c87d834137a3b5ebf287adeed513f18.zip
Add pagination headers on endpoints that support total count from database (#11145)
* begin work * import fmt * more work * empty commit Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'routers/api/v1/repo/issue.go')
-rw-r--r--routers/api/v1/repo/issue.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go
index 51f6efe8ab..937b581a6d 100644
--- a/routers/api/v1/repo/issue.go
+++ b/routers/api/v1/repo/issue.go
@@ -322,6 +322,8 @@ func ListIssues(ctx *context.APIContext) {
}
ctx.SetLinkHeader(ctx.Repo.Repository.NumIssues, listOptions.PageSize)
+ ctx.Header().Set("X-Total-Count", fmt.Sprintf("%d", ctx.Repo.Repository.NumIssues))
+
ctx.JSON(http.StatusOK, convert.ToAPIIssueList(issues))
}