package middleware

import "github.com/gogf/gf/net/ghttp"

// CROSMiddleWare 跨域请求中间件
// TODO:未完成配置信息对应
func CROSMiddleWare(skippers ...SkipperFunc) ghttp.HandlerFunc {
	return func(r *ghttp.Request) {
		if len(skippers) > 0 && skippers[0](r) {
			r.Middleware.Next()
			return
		}
		r.Response.CORSDefault()
		r.Middleware.Next()
	}
}
