diff options
author | yp05327 <576951401@qq.com> | 2024-01-19 11:45:23 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-19 10:45:23 +0800 |
commit | b60a7c3358cdeec3e0a731b68be33b6ba63a6563 (patch) | |
tree | 3211199f510d1f9ea2318bb596fab02262058014 /modules/private/key.go | |
parent | 4674aea25b54baf08594c54f061dee9e44190f02 (diff) | |
download | gitea-b60a7c3358cdeec3e0a731b68be33b6ba63a6563.tar.gz gitea-b60a7c3358cdeec3e0a731b68be33b6ba63a6563.zip |
Return `responseText` instead of string in some functions (#28836)
Follow
https://github.com/go-gitea/gitea/pull/28796#issuecomment-1891727591
Diffstat (limited to 'modules/private/key.go')
-rw-r--r-- | modules/private/key.go | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/modules/private/key.go b/modules/private/key.go index 08762bd401..dcd1714856 100644 --- a/modules/private/key.go +++ b/modules/private/key.go @@ -15,20 +15,16 @@ func UpdatePublicKeyInRepo(ctx context.Context, keyID, repoID int64) error { // Ask for running deliver hook and test pull request tasks. reqURL := setting.LocalURL + fmt.Sprintf("api/internal/ssh/%d/update/%d", keyID, repoID) req := newInternalRequest(ctx, reqURL, "POST") - _, extra := requestJSONResp(req, &responseText{}) + _, extra := requestJSONResp(req, &ResponseText{}) return extra.Error } // AuthorizedPublicKeyByContent searches content as prefix (leak e-mail part) // and returns public key found. -func AuthorizedPublicKeyByContent(ctx context.Context, content string) (string, ResponseExtra) { +func AuthorizedPublicKeyByContent(ctx context.Context, content string) (*ResponseText, ResponseExtra) { // Ask for running deliver hook and test pull request tasks. reqURL := setting.LocalURL + "api/internal/ssh/authorized_keys" req := newInternalRequest(ctx, reqURL, "POST") req.Param("content", content) - resp, extra := requestJSONResp(req, &responseText{}) - if extra.HasError() { - return "", extra - } - return resp.Text, extra + return requestJSONResp(req, &ResponseText{}) } |