-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Description
Description
As the title says, the Link header does not appear to be provided on the API route /org/{org}/teams. The limit and page parameters are respected.
Below is a snippet where I've dumped the headers for /repos/gentoo/gentoo/pulls and /orgs/bork/teams (bork being my test org). Notice the Access-Control-Expose-Headers does not include Link in the second request
>>> url = https://codeberg.org/api/v1/repos/gentoo/gentoo/pulls?state=all&limit=3
{'Access-Control-Expose-Headers': 'Link, X-Total-Count', 'Alt-Svc': 'h3=":443"; ma=2592000,h3=":443"; ma=2592000', 'Cache-Control': 'max-age=0, private, must-revalidate, no-transform', 'Content-Type': 'application/json;charset=utf-8', 'Date': 'Mon, 02 Feb 2026 13:00:04 GMT', 'Link': '<https://codeberg.org/api/v1/repos/gentoo/gentoo/pulls?limit=3&page=2&state=all>; rel="next",<https://codeberg.org/api/v1/repos/gentoo/gentoo/pulls?limit=3&page=9&state=all>; rel="last"', 'Permissions-Policy': 'interest-cohort=()', 'Strict-Transport-Security': 'max-age=63072000; includeSubDomains; preload', 'Vary': 'Origin', 'Via': '1.1 Caddy', 'X-Content-Type-Options': 'nosniff', 'X-Frame-Options': 'SAMEORIGIN', 'X-Total-Count': '26', 'Transfer-Encoding': 'chunked'}
>>> url = https://codeberg.org/api/v1/orgs/bork/teams/?limit=3
{'Access-Control-Expose-Headers': 'X-Total-Count', 'Alt-Svc': 'h3=":443"; ma=2592000,h3=":443"; ma=2592000', 'Cache-Control': 'max-age=0, private, must-revalidate, no-transform', 'Content-Length': '1948', 'Content-Type': 'application/json;charset=utf-8', 'Date': 'Mon, 02 Feb 2026 13:00:22 GMT', 'Permissions-Policy': 'interest-cohort=()', 'Strict-Transport-Security': 'max-age=63072000; includeSubDomains; preload', 'Vary': 'Origin', 'Via': '1.1 Caddy', 'X-Content-Type-Options': 'nosniff', 'X-Frame-Options': 'SAMEORIGIN', 'X-Total-Count': '51'}
I observed this on Codeberg and found what I believe to be the API route implementation here:
gitea/routers/api/v1/org/team.go
Lines 72 to 73 in 288d1f5
| ctx.SetTotalCountHeader(count) | |
| ctx.JSON(http.StatusOK, apiTeams) |
Compared to another paginated endpoint that I know to work on Codeberg:
gitea/routers/api/v1/repo/pull.go
Lines 157 to 159 in 288d1f5
| ctx.SetLinkHeader(int(maxResults), listOptions.PageSize) | |
| ctx.SetTotalCountHeader(maxResults) | |
| ctx.JSON(http.StatusOK, &apiPrs) |
Gitea Version
What's deployed on codeberg.org
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
No response
Operating System
No response
How are you running Gitea?
This has been observed on Codeberg.
Database
None