From f7a30e7b38a0204df0d30f2076f3f2d0cc4a18ee Mon Sep 17 00:00:00 2001 From: Alessandro Ros Date: Wed, 19 Jul 2023 00:22:52 +0200 Subject: [PATCH] api: return 404 when a path configuration is not found (#2067) (#2074) this involves /v2/config/paths/edit and /v2/config/paths/remove --- apidocs/openapi.yaml | 4 ++++ internal/core/api.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/apidocs/openapi.yaml b/apidocs/openapi.yaml index d4fd4c88..a899d1b3 100644 --- a/apidocs/openapi.yaml +++ b/apidocs/openapi.yaml @@ -605,6 +605,8 @@ paths: description: the request was successful. '400': description: invalid request. + '404': + description: configuration not found. '500': description: internal server error. @@ -625,6 +627,8 @@ paths: description: the request was successful. '400': description: invalid request. + '404': + description: configuration not found. '500': description: internal server error. diff --git a/internal/core/api.go b/internal/core/api.go index da1c8473..810e9fe8 100644 --- a/internal/core/api.go +++ b/internal/core/api.go @@ -409,7 +409,7 @@ func (a *api) onConfigPathsEdit(ctx *gin.Context) { newConfPath, ok := newConf.Paths[name] if !ok { - ctx.AbortWithStatus(http.StatusBadRequest) + ctx.AbortWithStatus(http.StatusNotFound) return }