소스 검색

feat: 更新若干功能

SongZihuan 1 년 전
부모
커밋
205c49383d
1개의 변경된 파일12개의 추가작업 그리고 0개의 파일을 삭제
  1. 12 0
      rest/server.go

+ 12 - 0
rest/server.go

@@ -238,6 +238,18 @@ func WithNotAllowedHandler(handler http.Handler) RunOption {
 	}
 }
 
+func WithOptionsHandler(handler http.Handler) RunOption {
+	return func(server *Server) {
+		server.router.SetOptionsHandler(handler)
+	}
+}
+
+func WithGlobalMiddleware(middleware httpx.MiddlewareFunc) RunOption {
+	return func(server *Server) {
+		server.router.SetMiddleware(middleware)
+	}
+}
+
 // WithPrefix adds group as a prefix to the route paths.
 func WithPrefix(group string) RouteOption {
 	return func(r *featuredRoutes) {