Skip to content

Commit 30651f1

Browse files
committed
style: 更新 Bing.Utils 版本并支持请求响应日志中间件过滤
1 parent b827041 commit 30651f1

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

framework/src/Bing.AspNetCore/Bing/AspNetCore/Logs/RequestResponseLoggerMiddleware.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Linq;
66
using System.Text;
77
using System.Threading.Tasks;
8+
using Bing.Helpers;
89
using Microsoft.AspNetCore.Http;
910
using Microsoft.Extensions.DependencyInjection;
1011
using Microsoft.Extensions.Options;
@@ -276,6 +277,13 @@ private bool FilterRequest(HttpContext context)
276277
// 过滤请求数据
277278
if (_options.RequestFilter == null || _options.RequestFilter.Count == 0)
278279
return false;
280+
// 请求路径 - 规则匹配
281+
var path = context.Request.Path.Value.ToLowerInvariant();
282+
foreach (var item in _options.RequestFilter)
283+
{
284+
if (FastPathMatcher.Match(item, path))
285+
return true;
286+
}
279287
return false;
280288
}
281289
}

modules/admin/src/Bing.Admin/Modules/AppModule.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ public override IServiceCollection AddServices(IServiceCollection services)
7979
{
8080
o.IsEnabled = true;
8181
o.Name = "Bing.Admin";
82+
o.RequestFilter.Add("/swagger/**");
83+
o.RequestFilter.Add("/swagger");
8284
});
8385
return services;
8486
}

version.dev.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<!-- All Microsoft packages -->
44
<MicrosoftPackageVersion>3.1.*</MicrosoftPackageVersion>
5-
<BingUtilsPackageVersion>1.4.0-preview-20220830-1</BingUtilsPackageVersion>
5+
<BingUtilsPackageVersion>1.4.0-preview-20220831-2</BingUtilsPackageVersion>
66
<FreeSQLPackageVersion>3.2.610</FreeSQLPackageVersion>
77
</PropertyGroup>
88
</Project>

0 commit comments

Comments
 (0)