1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Refactor HTTP request context (#17979)

This commit is contained in:
wxiaoguang
2021-12-15 14:59:57 +08:00
committed by GitHub
parent 9d943bf374
commit 4da1d97810
26 changed files with 139 additions and 177 deletions

View File

@@ -28,7 +28,7 @@ func UpdatePublicKeyInRepo(ctx *context.PrivateContext) {
deployKey, err := asymkey_model.GetDeployKeyByRepo(keyID, repoID)
if err != nil {
if asymkey_model.IsErrDeployKeyNotExist(err) {
ctx.PlainText(http.StatusOK, []byte("success"))
ctx.PlainText(http.StatusOK, "success")
return
}
ctx.JSON(http.StatusInternalServerError, private.Response{
@@ -44,7 +44,7 @@ func UpdatePublicKeyInRepo(ctx *context.PrivateContext) {
return
}
ctx.PlainText(http.StatusOK, []byte("success"))
ctx.PlainText(http.StatusOK, "success")
}
// AuthorizedPublicKeyByContent searches content as prefix (leak e-mail part)
@@ -59,5 +59,5 @@ func AuthorizedPublicKeyByContent(ctx *context.PrivateContext) {
})
return
}
ctx.PlainText(http.StatusOK, []byte(publicKey.AuthorizedString()))
ctx.PlainText(http.StatusOK, publicKey.AuthorizedString())
}