From 2f43be895f71c3621ca21dcb68fe6c7965fa613e Mon Sep 17 00:00:00 2001 From: Alex <1353716+alexstojda@users.noreply.github.com> Date: Tue, 3 Jan 2023 19:51:43 -0500 Subject: [PATCH] fix(gin-template): Respect ctx.Abort() Respect when c.Abort() is called in a middleware func. --- 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..ccd7271998 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}})