Skip to content

Commit 4e2b3a1

Browse files
authored
Merge pull request #21 from PandaTechAM/development
signalR fix and nuget updates
2 parents 3e381be + 26e2205 commit 4e2b3a1

File tree

5 files changed

+16
-9
lines changed

5 files changed

+16
-9
lines changed

src/SharedKernel/Extensions/HttpContextExtensions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ public static void MarkAsPrivateEndpoint(this HttpResponse response)
1414
response.Headers.Append("X-Private-Endpoint", "1");
1515
}
1616

17+
public static void MarkAsPrivateEndpoint(this IHttpContextAccessor contextAccessor)
18+
{
19+
contextAccessor.HttpContext?.Response.Headers.Append("X-Private-Endpoint", "1");
20+
}
21+
1722
public static void MarkAsPrivateEndpoint(this HttpContextAccessor contextAccessor)
1823
{
1924
contextAccessor.HttpContext?.Response.Headers.Append("X-Private-Endpoint", "1");

src/SharedKernel/Extensions/SignalRExtensions.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using Microsoft.AspNetCore.Builder;
2+
using Microsoft.AspNetCore.SignalR;
23
using Microsoft.Extensions.DependencyInjection;
4+
using ResponseCrafter.ExceptionHandlers.SignalR;
35
using StackExchange.Redis;
46

57
namespace SharedKernel.Extensions;
@@ -11,7 +13,7 @@ public static WebApplicationBuilder AddSignalR(this WebApplicationBuilder builde
1113
{
1214
builder
1315
.Services
14-
.AddSignalR()
16+
.AddSignalR(o => o.AddFilter<SignalRExceptionFilter>())
1517
.AddMessagePackProtocol();
1618

1719
return builder;
@@ -21,7 +23,7 @@ public static WebApplicationBuilder AddDistributedSignalR(this WebApplicationBui
2123
{
2224
builder
2325
.Services
24-
.AddSignalR()
26+
.AddSignalR(o => o.AddFilter<SignalRExceptionFilter>())
2527
.AddMessagePackProtocol()
2628
.AddStackExchangeRedis(builder.Configuration.GetRedisUrl(),
2729
options =>

src/SharedKernel/Logging/RequestResponseLoggingMiddleware.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ internal class RequestResponseLoggingMiddleware(RequestDelegate next, ILogger<Re
1919

2020
public async Task InvokeAsync(HttpContext context)
2121
{
22-
if (context.Request.Method.Equals("OPTIONS", StringComparison.OrdinalIgnoreCase))
22+
if (HttpMethods.IsOptions(context.Request.Method))
2323
{
2424
await next(context);
2525
return;
@@ -31,6 +31,7 @@ public async Task InvokeAsync(HttpContext context)
3131
var originalBodyStream = context.Response.Body;
3232
await using var responseBody = new MemoryStream();
3333
context.Response.Body = responseBody;
34+
3435
var stopwatch = Stopwatch.GetTimestamp();
3536
try
3637
{
@@ -81,7 +82,6 @@ public async Task InvokeAsync(HttpContext context)
8182
var body = await reader.ReadToEndAsync();
8283
var sanitizedHeaders = JsonSerializer.Serialize(RedactSensitiveData(headers));
8384
var bodyContent = JsonSerializer.Serialize(ParseAndRedactJson(body));
84-
8585
return (sanitizedHeaders, bodyContent);
8686
}
8787

src/SharedKernel/SharedKernel.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
<PackageReadmeFile>Readme.md</PackageReadmeFile>
99
<Authors>Pandatech</Authors>
1010
<Copyright>MIT</Copyright>
11-
<Version>1.0.20</Version>
11+
<Version>1.0.21</Version>
1212
<PackageId>Pandatech.SharedKernel</PackageId>
1313
<Title>Pandatech Shared Kernel Library</Title>
1414
<PackageTags>Pandatech, shared kernel, library, OpenAPI, Swagger, utilities, scalar</PackageTags>
1515
<Description>Pandatech.SharedKernel provides centralized configurations, utilities, and extensions for ASP.NET Core projects. For more information refere to readme.md document.</Description>
1616
<RepositoryUrl>https://github.com/PandaTechAM/be-lib-sharedkernel</RepositoryUrl>
17-
<PackageReleaseNotes>Nuget updates</PackageReleaseNotes>
17+
<PackageReleaseNotes>Nuget updates and SignalR fix</PackageReleaseNotes>
1818
</PropertyGroup>
1919

2020
<ItemGroup>
@@ -51,8 +51,8 @@
5151
<PackageReference Include="Pandatech.FluentMinimalApiMapper" Version="2.0.1" />
5252
<PackageReference Include="Pandatech.PandaVaultClient" Version="4.0.3" />
5353
<PackageReference Include="Pandatech.RegexBox" Version="3.0.0" />
54-
<PackageReference Include="Pandatech.ResponseCrafter" Version="5.1.1" />
55-
<PackageReference Include="Scalar.AspNetCore" Version="1.2.56" />
54+
<PackageReference Include="Pandatech.ResponseCrafter" Version="5.1.2" />
55+
<PackageReference Include="Scalar.AspNetCore" Version="1.2.61" />
5656
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
5757
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="7.2.0" />
5858
</ItemGroup>

test/SharedKernel.Tests/SharedKernel.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<ItemGroup>
1313
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
1414
<PackageReference Include="xunit" Version="2.9.2" />
15-
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
15+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0">
1616
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1717
<PrivateAssets>all</PrivateAssets>
1818
</PackageReference>

0 commit comments

Comments
 (0)