Skip to content

Commit

Permalink
Change content type in ErrorsMiddleware (#17)
Browse files Browse the repository at this point in the history
Co-authored-by: Artem Leshchev <[email protected]>
  • Loading branch information
aleshchev and Artem Leshchev authored Jul 8, 2024
1 parent d1a89d2 commit 3d498c1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
5 changes: 2 additions & 3 deletions src/Bss.Platform.Api.Middlewares/ErrorsMiddleware.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Net;
using System.Net.Mime;
using System.Text.Json;

using Bss.Platform.Api.Middlewares.Interfaces;

Expand Down Expand Up @@ -28,10 +27,10 @@ public async Task Invoke(HttpContext context)

private Task HandleExceptionAsync(HttpContext context, Exception exception)
{
context.Response.ContentType = MediaTypeNames.Application.Json;
context.Response.ContentType = MediaTypeNames.Text.Plain;
context.Response.StatusCode =
(int)(serviceProvider.GetService<IStatusCodeResolver>()?.Resolve(exception) ?? HttpStatusCode.InternalServerError);

return context.Response.WriteAsync(JsonSerializer.Serialize(exception.GetBaseException().Message));
return context.Response.WriteAsync(exception.GetBaseException().Message);
}
}
16 changes: 8 additions & 8 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@
<ItemGroup>
<PackageVersion Include="AspNetCore.HealthChecks.SqlServer" Version="8.0.2" />
<PackageVersion Include="Dapper" Version="2.1.35" />
<PackageVersion Include="DotNetCore.CAP.Dashboard" Version="8.1.2" />
<PackageVersion Include="DotNetCore.CAP.RabbitMQ" Version="8.1.2" />
<PackageVersion Include="DotNetCore.CAP.SqlServer" Version="8.1.2" />
<PackageVersion Include="DotNetCore.CAP.Dashboard" Version="8.2.0" />
<PackageVersion Include="DotNetCore.CAP.RabbitMQ" Version="8.2.0" />
<PackageVersion Include="DotNetCore.CAP.SqlServer" Version="8.2.0" />
<PackageVersion Include="Microsoft.SqlServer.SqlManagementObjects" Version="171.30.0" />
<PackageVersion Include="Savorboard.CAP.InMemoryMessageQueue" Version="8.0.0" />
<PackageVersion Include="MediatR" Version="12.2.0" />
<PackageVersion Include="Savorboard.CAP.InMemoryMessageQueue" Version="8.2.0" />
<PackageVersion Include="MediatR" Version="12.3.0" />
<PackageVersion Include="Microsoft.ApplicationInsights" Version="2.22.0" />
<PackageVersion Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
<PackageVersion Include="Microsoft.ApplicationInsights.Kubernetes" Version="6.1.2" />
<PackageVersion Include="Microsoft.ApplicationInsights.Kubernetes" Version="7.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
<PackageVersion Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.2.1" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageVersion Include="NHibernate" Version="5.5.1" />
<PackageVersion Include="NHibernate" Version="5.5.2" />
<PackageVersion Include="RabbitMQ.Client" Version="6.8.1" />
<PackageVersion Include="Polly" Version="8.4.0" />
<PackageVersion Include="Polly" Version="8.4.1" />
<PackageVersion Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.6.2" />
</ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/__SolutionItems/CommonAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
[assembly: AssemblyCompany("Luxoft")]
[assembly: AssemblyCopyright("Copyright © Luxoft 2024")]

[assembly: AssemblyVersion("1.5.2.0")]
[assembly: AssemblyFileVersion("1.5.2.0")]
[assembly: AssemblyInformationalVersion("1.5.2.0")]
[assembly: AssemblyVersion("1.5.3.0")]
[assembly: AssemblyFileVersion("1.5.3.0")]
[assembly: AssemblyInformationalVersion("1.5.3.0")]

#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
Expand Down

0 comments on commit 3d498c1

Please sign in to comment.