Return responseText instead of string in some functions (#28836)

Follow
https://github.com/go-gitea/gitea/pull/28796#issuecomment-1891727591
This commit is contained in:
yp05327 2024-01-19 11:45:23 +09:00 committed by GitHub
parent 4674aea25b
commit b60a7c3358
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 18 additions and 30 deletions

View file

@ -101,7 +101,7 @@ func HookPreReceive(ctx context.Context, ownerName, repoName string, opts HookOp
reqURL := setting.LocalURL + fmt.Sprintf("api/internal/hook/pre-receive/%s/%s", url.PathEscape(ownerName), url.PathEscape(repoName))
req := newInternalRequest(ctx, reqURL, "POST", opts)
req.SetReadWriteTimeout(time.Duration(60+len(opts.OldCommitIDs)) * time.Second)
_, extra := requestJSONResp(req, &responseText{})
_, extra := requestJSONResp(req, &ResponseText{})
return extra
}
@ -130,7 +130,7 @@ func SetDefaultBranch(ctx context.Context, ownerName, repoName, branch string) R
url.PathEscape(branch),
)
req := newInternalRequest(ctx, reqURL, "POST")
_, extra := requestJSONResp(req, &responseText{})
_, extra := requestJSONResp(req, &ResponseText{})
return extra
}
@ -138,6 +138,6 @@ func SetDefaultBranch(ctx context.Context, ownerName, repoName, branch string) R
func SSHLog(ctx context.Context, isErr bool, msg string) error {
reqURL := setting.LocalURL + "api/internal/ssh/log"
req := newInternalRequest(ctx, reqURL, "POST", &SSHLogOption{IsError: isErr, Message: msg})
_, extra := requestJSONResp(req, &responseText{})
_, extra := requestJSONResp(req, &ResponseText{})
return extra.Error
}