diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2022-08-05 03:38:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-05 09:38:04 +0800 |
commit | 65176fdaf3b273aff6b56b848d202bebc9588d25 (patch) | |
tree | 7487951250aa4df7243a1906f6382b30dbab4f19 /routers | |
parent | aac905dcfb61a1144240d78d953487bd213985b7 (diff) | |
download | gitea-65176fdaf3b273aff6b56b848d202bebc9588d25.tar.gz gitea-65176fdaf3b273aff6b56b848d202bebc9588d25.zip |
Send correct NuGet status codes (#20647) (#20677)
* Fixed status codes.
* Fixed status codes.
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/packages/nuget/nuget.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/routers/api/packages/nuget/nuget.go b/routers/api/packages/nuget/nuget.go index 013c0c1e33..6bdd0ed5e0 100644 --- a/routers/api/packages/nuget/nuget.go +++ b/routers/api/packages/nuget/nuget.go @@ -215,7 +215,7 @@ func UploadPackage(ctx *context.Context) { ) if err != nil { if err == packages_model.ErrDuplicatePackageVersion { - apiError(ctx, http.StatusBadRequest, err) + apiError(ctx, http.StatusConflict, err) return } apiError(ctx, http.StatusInternalServerError, err) @@ -272,7 +272,7 @@ func UploadSymbolPackage(ctx *context.Context) { case packages_model.ErrPackageNotExist: apiError(ctx, http.StatusNotFound, err) case packages_model.ErrDuplicatePackageFile: - apiError(ctx, http.StatusBadRequest, err) + apiError(ctx, http.StatusConflict, err) default: apiError(ctx, http.StatusInternalServerError, err) } @@ -297,7 +297,7 @@ func UploadSymbolPackage(ctx *context.Context) { if err != nil { switch err { case packages_model.ErrDuplicatePackageFile: - apiError(ctx, http.StatusBadRequest, err) + apiError(ctx, http.StatusConflict, err) default: apiError(ctx, http.StatusInternalServerError, err) } @@ -412,4 +412,6 @@ func DeletePackage(ctx *context.Context) { } apiError(ctx, http.StatusInternalServerError, err) } + + ctx.Status(http.StatusNoContent) } |