summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/org/org.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/org/org.go')
-rw-r--r--routers/api/v1/org/org.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/routers/api/v1/org/org.go b/routers/api/v1/org/org.go
index 220a7dc265..1d277521cc 100644
--- a/routers/api/v1/org/org.go
+++ b/routers/api/v1/org/org.go
@@ -6,6 +6,7 @@
package org
import (
+ "fmt"
"net/http"
"code.gitea.io/gitea/models"
@@ -115,8 +116,10 @@ func GetAll(ctx *context.APIContext) {
}
}
- publicOrgs, _, err := models.SearchUsers(&models.SearchUserOptions{
- ListOptions: utils.GetListOptions(ctx),
+ listOptions := utils.GetListOptions(ctx)
+
+ publicOrgs, maxResults, err := models.SearchUsers(&models.SearchUserOptions{
+ ListOptions: listOptions,
Type: models.UserTypeOrganization,
OrderBy: models.SearchOrderByAlphabetically,
Visible: vMode,
@@ -130,6 +133,8 @@ func GetAll(ctx *context.APIContext) {
orgs[i] = convert.ToOrganization(publicOrgs[i])
}
+ ctx.SetLinkHeader(int(maxResults), listOptions.PageSize)
+ ctx.Header().Set("X-Total-Count", fmt.Sprintf("%d", maxResults))
ctx.JSON(http.StatusOK, &orgs)
}