diff options
Diffstat (limited to 'routers/api/v1/user')
-rw-r--r-- | routers/api/v1/user/app.go | 2 | ||||
-rw-r--r-- | routers/api/v1/user/follower.go | 2 | ||||
-rw-r--r-- | routers/api/v1/user/gpg_key.go | 2 | ||||
-rw-r--r-- | routers/api/v1/user/key.go | 6 | ||||
-rw-r--r-- | routers/api/v1/user/star.go | 2 | ||||
-rw-r--r-- | routers/api/v1/user/user.go | 2 | ||||
-rw-r--r-- | routers/api/v1/user/watch.go | 2 |
7 files changed, 9 insertions, 9 deletions
diff --git a/routers/api/v1/user/app.go b/routers/api/v1/user/app.go index f4870431c2..ef53e95d8b 100644 --- a/routers/api/v1/user/app.go +++ b/routers/api/v1/user/app.go @@ -112,7 +112,7 @@ func DeleteAccessToken(ctx *context.APIContext) { tokenID := ctx.ParamsInt64(":id") if err := models.DeleteAccessTokenByID(tokenID, ctx.User.ID); err != nil { if models.IsErrAccessTokenNotExist(err) { - ctx.Status(404) + ctx.NotFound() } else { ctx.Error(500, "DeleteAccessTokenByID", err) } diff --git a/routers/api/v1/user/follower.go b/routers/api/v1/user/follower.go index 284b7323c3..c2f0c6e651 100644 --- a/routers/api/v1/user/follower.go +++ b/routers/api/v1/user/follower.go @@ -113,7 +113,7 @@ func checkUserFollowing(ctx *context.APIContext, u *models.User, followID int64) if u.IsFollowing(followID) { ctx.Status(204) } else { - ctx.Status(404) + ctx.NotFound() } } diff --git a/routers/api/v1/user/gpg_key.go b/routers/api/v1/user/gpg_key.go index 5301a0f2db..9d6579e413 100644 --- a/routers/api/v1/user/gpg_key.go +++ b/routers/api/v1/user/gpg_key.go @@ -90,7 +90,7 @@ func GetGPGKey(ctx *context.APIContext) { key, err := models.GetGPGKeyByID(ctx.ParamsInt64(":id")) if err != nil { if models.IsErrGPGKeyNotExist(err) { - ctx.Status(404) + ctx.NotFound() } else { ctx.Error(500, "GetGPGKeyByID", err) } diff --git a/routers/api/v1/user/key.go b/routers/api/v1/user/key.go index d8ab752b2b..8e0cde0535 100644 --- a/routers/api/v1/user/key.go +++ b/routers/api/v1/user/key.go @@ -42,7 +42,7 @@ func GetUserByParamsName(ctx *context.APIContext, name string) *models.User { user, err := models.GetUserByName(ctx.Params(name)) if err != nil { if models.IsErrUserNotExist(err) { - ctx.Status(404) + ctx.NotFound() } else { ctx.Error(500, "GetUserByName", err) } @@ -165,7 +165,7 @@ func GetPublicKey(ctx *context.APIContext) { key, err := models.GetPublicKeyByID(ctx.ParamsInt64(":id")) if err != nil { if models.IsErrKeyNotExist(err) { - ctx.Status(404) + ctx.NotFound() } else { ctx.Error(500, "GetPublicKeyByID", err) } @@ -246,7 +246,7 @@ func DeletePublicKey(ctx *context.APIContext) { // "$ref": "#/responses/notFound" if err := models.DeletePublicKey(ctx.User, ctx.ParamsInt64(":id")); err != nil { if models.IsErrKeyNotExist(err) { - ctx.Status(404) + ctx.NotFound() } else if models.IsErrKeyAccessDenied(err) { ctx.Error(403, "", "You do not have access to this key") } else { diff --git a/routers/api/v1/user/star.go b/routers/api/v1/user/star.go index b0016399c8..62c820f8f4 100644 --- a/routers/api/v1/user/star.go +++ b/routers/api/v1/user/star.go @@ -96,7 +96,7 @@ func IsStarring(ctx *context.APIContext) { if models.IsStaring(ctx.User.ID, ctx.Repo.Repository.ID) { ctx.Status(204) } else { - ctx.Status(404) + ctx.NotFound() } } diff --git a/routers/api/v1/user/user.go b/routers/api/v1/user/user.go index cbc7bbc238..a44eb03c39 100644 --- a/routers/api/v1/user/user.go +++ b/routers/api/v1/user/user.go @@ -109,7 +109,7 @@ func GetInfo(ctx *context.APIContext) { u, err := models.GetUserByName(ctx.Params(":username")) if err != nil { if models.IsErrUserNotExist(err) { - ctx.Status(404) + ctx.NotFound() } else { ctx.Error(500, "GetUserByName", err) } diff --git a/routers/api/v1/user/watch.go b/routers/api/v1/user/watch.go index 4afa18be2a..2ce0be2ff0 100644 --- a/routers/api/v1/user/watch.go +++ b/routers/api/v1/user/watch.go @@ -103,7 +103,7 @@ func IsWatching(ctx *context.APIContext) { RepositoryURL: repositoryURL(ctx.Repo.Repository), }) } else { - ctx.Status(404) + ctx.NotFound() } } |