From 90b7b7ec1cdad9b0ad191fb29c9ccc2865bbadfb Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Mon, 14 Aug 2023 13:42:51 +0300 Subject: [PATCH 1/2] fix swagger handler Signed-off-by: Vasiliy Tolstov --- handler/swagger/swagger.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/handler/swagger/swagger.go b/handler/swagger/swagger.go index df85a63..35887f7 100644 --- a/handler/swagger/swagger.go +++ b/handler/swagger/swagger.go @@ -29,6 +29,11 @@ var Handler = func(dst map[string]interface{}, fsys fs.FS) http.HandlerFunc { return } + if dst == nil { + w.WriteHeader(http.StatusOK) + _, _ = w.Write(buf) + } + var src interface{} if err = c.Unmarshal(buf, src); err != nil { -- 2.45.2 From a665b697067e2b76766adb0e99a0b0338064861e Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Mon, 14 Aug 2023 13:43:19 +0300 Subject: [PATCH 2/2] fix swagger handler Signed-off-by: Vasiliy Tolstov --- handler/swagger/swagger.go | 1 + 1 file changed, 1 insertion(+) diff --git a/handler/swagger/swagger.go b/handler/swagger/swagger.go index 35887f7..15533d8 100644 --- a/handler/swagger/swagger.go +++ b/handler/swagger/swagger.go @@ -32,6 +32,7 @@ var Handler = func(dst map[string]interface{}, fsys fs.FS) http.HandlerFunc { if dst == nil { w.WriteHeader(http.StatusOK) _, _ = w.Write(buf) + return } var src interface{} -- 2.45.2