Skip to content

Commit ecb4ae6

Browse files
author
Royce Remer
committed
honor pagination queryparams on requests to /repo/git/refs
1 parent a25081f commit ecb4ae6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

routers/api/v1/repo/git_ref.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ func GetGitRefs(ctx *context.APIContext) {
7676
}
7777

7878
func getGitRefsInternal(ctx *context.APIContext, filter string) {
79+
listOptions := utils.GetListOptions(ctx)
7980
refs, lastMethodName, err := utils.GetGitRefs(ctx, filter)
8081
if err != nil {
8182
ctx.APIErrorInternal(fmt.Errorf("%s: %w", lastMethodName, err))
@@ -104,5 +105,7 @@ func getGitRefsInternal(ctx *context.APIContext, filter string) {
104105
ctx.JSON(http.StatusOK, &apiRefs[0])
105106
return
106107
}
108+
ctx.SetLinkHeader(len(apiRefs), listOptions.PageSize)
109+
ctx.SetTotalCountHeader(int64(len(apiRefs)))
107110
ctx.JSON(http.StatusOK, &apiRefs)
108111
}

0 commit comments

Comments
 (0)