diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2021-12-15 14:59:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-15 14:59:57 +0800 |
commit | 4da1d9781025aa4a85899b1ddeb25aabbaa82703 (patch) | |
tree | 9714f71f2fb042e44d418fbcfc56cd8440a1bbb1 /routers/web/user | |
parent | 9d943bf374e56e4d403303a6a2caafc1c79cdb6f (diff) | |
download | gitea-4da1d9781025aa4a85899b1ddeb25aabbaa82703.tar.gz gitea-4da1d9781025aa4a85899b1ddeb25aabbaa82703.zip |
Refactor HTTP request context (#17979)
Diffstat (limited to 'routers/web/user')
-rw-r--r-- | routers/web/user/auth.go | 2 | ||||
-rw-r--r-- | routers/web/user/home.go | 4 | ||||
-rw-r--r-- | routers/web/user/oauth.go | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/routers/web/user/auth.go b/routers/web/user/auth.go index 55a4b11007..178852d3fb 100644 --- a/routers/web/user/auth.go +++ b/routers/web/user/auth.go @@ -506,7 +506,7 @@ func U2FSign(ctx *context.Context) { if redirect == "" { redirect = setting.AppSubURL + "/" } - ctx.PlainText(200, []byte(redirect)) + ctx.PlainText(http.StatusOK, redirect) return } } diff --git a/routers/web/user/home.go b/routers/web/user/home.go index bad621f91f..975262cf9c 100644 --- a/routers/web/user/home.go +++ b/routers/web/user/home.go @@ -839,7 +839,7 @@ func ShowSSHKeys(ctx *context.Context, uid int64) { buf.WriteString(keys[i].OmitEmail()) buf.WriteString("\n") } - ctx.PlainText(200, buf.Bytes()) + ctx.PlainTextBytes(http.StatusOK, buf.Bytes()) } // ShowGPGKeys output all the public GPG keys of user by uid @@ -878,7 +878,7 @@ func ShowGPGKeys(ctx *context.Context, uid int64) { } } writer.Close() - ctx.PlainText(200, buf.Bytes()) + ctx.PlainTextBytes(http.StatusOK, buf.Bytes()) } // Email2User show user page via email diff --git a/routers/web/user/oauth.go b/routers/web/user/oauth.go index d3baeaedc4..3795d4e5b8 100644 --- a/routers/web/user/oauth.go +++ b/routers/web/user/oauth.go @@ -251,7 +251,7 @@ type userInfoResponse struct { func InfoOAuth(ctx *context.Context) { if ctx.User == nil || ctx.Data["AuthedMethod"] != (&auth.OAuth2{}).Name() { ctx.Resp.Header().Set("WWW-Authenticate", `Bearer realm=""`) - ctx.HandleText(http.StatusUnauthorized, "no valid authorization") + ctx.PlainText(http.StatusUnauthorized, "no valid authorization") return } @@ -301,7 +301,7 @@ func getOAuthGroupsForUser(user *user_model.User) ([]string, error) { func IntrospectOAuth(ctx *context.Context) { if ctx.User == nil { ctx.Resp.Header().Set("WWW-Authenticate", `Bearer realm=""`) - ctx.HandleText(http.StatusUnauthorized, "no valid authorization") + ctx.PlainText(http.StatusUnauthorized, "no valid authorization") return } |