From f64b4e47c3ce4d8203d046d583168800f075128e Mon Sep 17 00:00:00 2001 From: lihanbo Date: Mon, 4 Nov 2024 15:13:58 +0800 Subject: [PATCH] =?UTF-8?q?105040=20=E8=B0=83=E6=95=B4=E4=B8=AD=E9=97=B4?= =?UTF-8?q?=E4=BB=B6=E4=BC=98=E5=85=88=E7=BA=A7=EF=BC=8C=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=A2=84=E6=A3=80=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LFlow.Permission/PermissionMiddleware.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/LFlow.Permission/PermissionMiddleware.cs b/LFlow.Permission/PermissionMiddleware.cs index bbf4a11..fa21d74 100644 --- a/LFlow.Permission/PermissionMiddleware.cs +++ b/LFlow.Permission/PermissionMiddleware.cs @@ -17,7 +17,7 @@ public class PermissionMiddleware : ILFlowMiddleware /// /// 优先级 /// - public int Priority => 2; + public int Priority => 1; /// /// 执行入口 @@ -45,6 +45,11 @@ public class PermissionMiddleware : ILFlowMiddleware await context.Response.WriteAsync(JsonConvert.SerializeObject(ApiResult.FailResult("无权限!", 100501))); } } - + // 预检请求 + if (context.Request.Method == "OPTIONS") + { + await next(); + // context.Response.StatusCode = StatusCodes.Status200OK; + } } } \ No newline at end of file