From 55562a9f004892f953c5b8e66775cc1de1306651 Mon Sep 17 00:00:00 2001 From: Polianin Nikita Date: Mon, 23 Dec 2024 06:29:29 +0300 Subject: [PATCH] feat: add default response type --- Endpoint/Program.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Endpoint/Program.cs b/Endpoint/Program.cs index b643ee8..cd07ac5 100644 --- a/Endpoint/Program.cs +++ b/Endpoint/Program.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.HttpOverrides; +using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; @@ -58,7 +59,10 @@ public class Program builder.Host.AddCustomSerilog(); AddDatabase(builder.Services, builder.Configuration, healthCheckBuilder); - builder.Services.AddControllers(); + builder.Services.AddControllers(options => + { + options.Filters.Add(new ProducesResponseTypeAttribute(StatusCodes.Status500InternalServerError)); + }); builder.Services.AddSingleton(); builder.Services.AddSingleton();