You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it seems no checks on middleware's call is being made.
Changing the MiddlewareFunc type to func(c *gin.Context) (err error) and acting according as per the returned error would honor the defined middleware in case of failures.
var err error
for _, middleware := range siw.HandlerMiddlewares {
err = middleware(c)
if err != nil {
c.JSON(http.StatusBadRequest, gin.H{"msg": "Middleware failure: " + err.Error()})
return
}
}
Please let me know if this can be acheived through any other ways. Thank you.
The text was updated successfully, but these errors were encountered:
Using oapi-codegen v1.11.0 to generate the server stub for the below spec
In main.go, a token check middleware is added as a Gin Server Option
Sample output
Success - correct token
Undesired reponse - wrong token
From the code
it seems no checks on middleware's call is being made.
Changing the
MiddlewareFunc
type tofunc(c *gin.Context) (err error)
and acting according as per the returned error would honor the defined middleware in case of failures.Please let me know if this can be acheived through any other ways. Thank you.
The text was updated successfully, but these errors were encountered: