mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-25 11:22:16 +00:00
Add Access-Control-Expose-Headers (#12446)
Fix #12424 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
parent
e266ba30cc
commit
2ef318e6f1
14 changed files with 19 additions and 0 deletions
|
@ -173,6 +173,8 @@ func SearchIssues(ctx *context.APIContext) {
|
|||
}
|
||||
|
||||
ctx.SetLinkHeader(issueCount, setting.UI.IssuePagingNum)
|
||||
ctx.Header().Set("X-Total-Count", fmt.Sprintf("%d", issueCount))
|
||||
ctx.Header().Set("Access-Control-Expose-Headers", "X-Total-Count, Link")
|
||||
ctx.JSON(http.StatusOK, convert.ToAPIIssueList(issues))
|
||||
}
|
||||
|
||||
|
@ -322,6 +324,7 @@ 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.Header().Set("Access-Control-Expose-Headers", "X-Total-Count, Link")
|
||||
|
||||
ctx.JSON(http.StatusOK, convert.ToAPIIssueList(issues))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue