fix🐛: demo中间件添加环境判断

This commit is contained in:
wenjianzhang authored and GitHub committed 2022-11-16 12:05:33 +08:00
1 parent c8b27492eb
commit 7d7d8484d4
1 file changed
+3 -1
+3 -1
View File
@@ -8,6 +8,7 @@ import (
func DemoEvn() gin.HandlerFunc { func DemoEvn() gin.HandlerFunc {
return func(c *gin.Context) { return func(c *gin.Context) {
method := c.Request.Method method := c.Request.Method
if config.ApplicationConfig.Mode == "demo" {
if method == "GET" || if method == "GET" ||
method == "OPTIONS" || method == "OPTIONS" ||
c.Request.RequestURI == "/api/v1/login" || c.Request.RequestURI == "/api/v1/login" ||
@@ -21,6 +22,7 @@ func DemoEvn() gin.HandlerFunc {
c.Abort() c.Abort()
return return
} }
}
c.Next()
} }
} }