aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/user
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-08-13 18:18:18 +0100
committerGitHub <noreply@github.com>2020-08-13 18:18:18 +0100
commit2ef318e6f1d0c674e894d2d1f25ca79498663466 (patch)
tree4914d7c95e814af2ffdc8ea7101b6f1b86e03ae4 /routers/api/v1/user
parente266ba30cca17bdb5c50fd0cd30d2e429e58ac26 (diff)
downloadgitea-2ef318e6f1d0c674e894d2d1f25ca79498663466.tar.gz
gitea-2ef318e6f1d0c674e894d2d1f25ca79498663466.zip
Add Access-Control-Expose-Headers (#12446)
Fix #12424 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'routers/api/v1/user')
-rw-r--r--routers/api/v1/user/repo.go2
-rw-r--r--routers/api/v1/user/user.go1
2 files changed, 3 insertions, 0 deletions
diff --git a/routers/api/v1/user/repo.go b/routers/api/v1/user/repo.go
index dbd18f133d..ae5e319c27 100644
--- a/routers/api/v1/user/repo.go
+++ b/routers/api/v1/user/repo.go
@@ -43,6 +43,7 @@ func listUserRepos(ctx *context.APIContext, u *models.User, private bool) {
ctx.SetLinkHeader(int(count), opts.PageSize)
ctx.Header().Set("X-Total-Count", strconv.FormatInt(count, 10))
+ ctx.Header().Set("Access-Control-Expose-Headers", "X-Total-Count, Link")
ctx.JSON(http.StatusOK, &apiRepos)
}
@@ -129,6 +130,7 @@ func ListMyRepos(ctx *context.APIContext) {
ctx.SetLinkHeader(int(count), opts.ListOptions.PageSize)
ctx.Header().Set("X-Total-Count", strconv.FormatInt(count, 10))
+ ctx.Header().Set("Access-Control-Expose-Headers", "X-Total-Count, Link")
ctx.JSON(http.StatusOK, &results)
}
diff --git a/routers/api/v1/user/user.go b/routers/api/v1/user/user.go
index 426501f331..b552c1353a 100644
--- a/routers/api/v1/user/user.go
+++ b/routers/api/v1/user/user.go
@@ -82,6 +82,7 @@ func Search(ctx *context.APIContext) {
ctx.SetLinkHeader(int(maxResults), listOptions.PageSize)
ctx.Header().Set("X-Total-Count", fmt.Sprintf("%d", maxResults))
+ ctx.Header().Set("Access-Control-Expose-Headers", "X-Total-Count, Link")
ctx.JSON(http.StatusOK, map[string]interface{}{
"ok": true,