From ee099e5d999357ff7b90df6f9ce6d163634a56d3 Mon Sep 17 00:00:00 2001 From: Christoph Heidenreich Date: Mon, 16 Jan 2023 17:11:39 +0100 Subject: [PATCH 1/2] gin middleware abort support --- pkg/codegen/templates/gin/gin-wrappers.tmpl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/codegen/templates/gin/gin-wrappers.tmpl b/pkg/codegen/templates/gin/gin-wrappers.tmpl index b16776b815..2b745d98bc 100644 --- a/pkg/codegen/templates/gin/gin-wrappers.tmpl +++ b/pkg/codegen/templates/gin/gin-wrappers.tmpl @@ -176,6 +176,9 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(c *gin.Context) { for _, middleware := range siw.HandlerMiddlewares { middleware(c) + if(c.IsAborted()){ + return + } } siw.Handler.{{.OperationId}}(c{{genParamNames .PathParams}}{{if .RequiresParamObject}}, params{{end}}) From 9b9971cf05e5e3d4b9257098dd0d9c4da5c84d89 Mon Sep 17 00:00:00 2001 From: Christoph Heidenreich Date: Mon, 16 Jan 2023 17:19:52 +0100 Subject: [PATCH 2/2] tabs -> whitespace --- pkg/codegen/templates/gin/gin-wrappers.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/codegen/templates/gin/gin-wrappers.tmpl b/pkg/codegen/templates/gin/gin-wrappers.tmpl index 2b745d98bc..ad3410d7b5 100644 --- a/pkg/codegen/templates/gin/gin-wrappers.tmpl +++ b/pkg/codegen/templates/gin/gin-wrappers.tmpl @@ -177,8 +177,8 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(c *gin.Context) { for _, middleware := range siw.HandlerMiddlewares { middleware(c) if(c.IsAborted()){ - return - } + return + } } siw.Handler.{{.OperationId}}(c{{genParamNames .PathParams}}{{if .RequiresParamObject}}, params{{end}})