summaryrefslogtreecommitdiffstats
path: root/services/lfs
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2022-03-23 05:54:07 +0100
committerGitHub <noreply@github.com>2022-03-23 12:54:07 +0800
commit3f280f89e7471a6dcdaefccc64a8d39188970e63 (patch)
treeff09b6dcb00b4c0ff0c436c4523d89a5c13f3a94 /services/lfs
parent395117d3014124b9147a1aabf76ee175e720b275 (diff)
downloadgitea-3f280f89e7471a6dcdaefccc64a8d39188970e63.tar.gz
gitea-3f280f89e7471a6dcdaefccc64a8d39188970e63.zip
Update HTTP status codes to modern codes (#18063)
* 2xx/3xx/4xx/5xx -> http.Status... * http.StatusFound -> http.StatusTemporaryRedirect * http.StatusMovedPermanently -> http.StatusPermanentRedirect
Diffstat (limited to 'services/lfs')
-rw-r--r--services/lfs/locks.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/services/lfs/locks.go b/services/lfs/locks.go
index a96e931fd9..fa51470d62 100644
--- a/services/lfs/locks.go
+++ b/services/lfs/locks.go
@@ -52,7 +52,7 @@ func GetListLockHandler(ctx *context.Context) {
if err != nil {
log.Debug("Could not find repository: %s/%s - %s", rv.User, rv.Repo, err)
ctx.Resp.Header().Set("WWW-Authenticate", "Basic realm=gitea-lfs")
- ctx.JSON(401, api.LFSLockError{
+ ctx.JSON(http.StatusUnauthorized, api.LFSLockError{
Message: "You must have pull access to list locks",
})
return
@@ -139,7 +139,7 @@ func PostLockHandler(ctx *context.Context) {
if err != nil {
log.Error("Unable to get repository: %s/%s Error: %v", userName, repoName, err)
ctx.Resp.Header().Set("WWW-Authenticate", "Basic realm=gitea-lfs")
- ctx.JSON(401, api.LFSLockError{
+ ctx.JSON(http.StatusUnauthorized, api.LFSLockError{
Message: "You must have push access to create locks",
})
return
@@ -164,7 +164,7 @@ func PostLockHandler(ctx *context.Context) {
dec := json.NewDecoder(bodyReader)
if err := dec.Decode(&req); err != nil {
log.Warn("Failed to decode lock request as json. Error: %v", err)
- writeStatus(ctx, 400)
+ writeStatus(ctx, http.StatusBadRequest)
return
}
@@ -206,7 +206,7 @@ func VerifyLockHandler(ctx *context.Context) {
if err != nil {
log.Error("Unable to get repository: %s/%s Error: %v", userName, repoName, err)
ctx.Resp.Header().Set("WWW-Authenticate", "Basic realm=gitea-lfs")
- ctx.JSON(401, api.LFSLockError{
+ ctx.JSON(http.StatusUnauthorized, api.LFSLockError{
Message: "You must have push access to verify locks",
})
return
@@ -272,7 +272,7 @@ func UnLockHandler(ctx *context.Context) {
if err != nil {
log.Error("Unable to get repository: %s/%s Error: %v", userName, repoName, err)
ctx.Resp.Header().Set("WWW-Authenticate", "Basic realm=gitea-lfs")
- ctx.JSON(401, api.LFSLockError{
+ ctx.JSON(http.StatusUnauthorized, api.LFSLockError{
Message: "You must have push access to delete locks",
})
return
@@ -297,7 +297,7 @@ func UnLockHandler(ctx *context.Context) {
dec := json.NewDecoder(bodyReader)
if err := dec.Decode(&req); err != nil {
log.Warn("Failed to decode lock request as json. Error: %v", err)
- writeStatus(ctx, 400)
+ writeStatus(ctx, http.StatusBadRequest)
return
}