Skip to content

Commit

Permalink
fix: 错误的中间件使用
Browse files Browse the repository at this point in the history
  • Loading branch information
WindowsSov8forUs committed Jun 20, 2024
1 parent a834b0c commit 782eba8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ func (server *Server) setupV1Engine(api, apiV2 openapi.OpenAPI) *gin.Engine {
engine.Use(
gin.Recovery(),
httpapi.HeadersSetMiddleware("1.1"),
httpapi.HeadersValidateMiddleware(),
)

webSocketGroup := engine.Group(fmt.Sprintf("%s/v1/events", server.conf.Satori.Path))
Expand All @@ -102,6 +101,7 @@ func (server *Server) setupV1Engine(api, apiV2 openapi.OpenAPI) *gin.Engine {
resourceGroup := engine.Group(fmt.Sprintf("%s/v1/", server.conf.Satori.Path))
// 资源接口处理函数
resourceGroup.Use(
httpapi.HeadersValidateMiddleware(),
httpapi.AuthenticateMiddleware("http_api"),
httpapi.BotValidateMiddleware(),
)
Expand All @@ -120,6 +120,7 @@ func (server *Server) setupV1Engine(api, apiV2 openapi.OpenAPI) *gin.Engine {

adminGroup := engine.Group(fmt.Sprintf("%s/v1/admin/", server.conf.Satori.Path))
// 管理接口处理函数
adminGroup.Use(httpapi.HeadersValidateMiddleware())
adminGroup.POST(":method", func(c *gin.Context) {
method := c.Param("method")
// 将请求输出
Expand Down

0 comments on commit 782eba8

Please sign in to comment.