diff --git a/NetinaShop.Api/Program.cs b/NetinaShop.Api/Program.cs index c3ff869..837ee88 100644 --- a/NetinaShop.Api/Program.cs +++ b/NetinaShop.Api/Program.cs @@ -101,6 +101,10 @@ if (app.Environment.IsDevelopment()) //app.UseSwagger(); //app.UseSwaggerUI(); } +else +{ + app.UseHsts(); +} app.UseCors(x => x .SetIsOriginAllowed(origin => true) .AllowAnyMethod() diff --git a/NetinaShop.Api/WebFramework/MiddleWares/ExceptionHandlerMiddleware.cs b/NetinaShop.Api/WebFramework/MiddleWares/ExceptionHandlerMiddleware.cs index 01e1bad..52314a0 100644 --- a/NetinaShop.Api/WebFramework/MiddleWares/ExceptionHandlerMiddleware.cs +++ b/NetinaShop.Api/WebFramework/MiddleWares/ExceptionHandlerMiddleware.cs @@ -1,5 +1,6 @@ using System; using System.Security.Cryptography; +using Microsoft.AspNetCore.Http; using NetinaShop.Repository.Migrations; using Refit; @@ -146,7 +147,7 @@ public class ExceptionHandlerMiddleware context.Response.StatusCode = (int)httpStatusCode; context.Response.ContentType = "application/json"; - await context.Response.WriteAsync(json); + await context.Response.WriteAsJsonAsync(result); } @@ -172,7 +173,7 @@ public class ExceptionHandlerMiddleware context.Response.StatusCode = (int)httpStatusCode; context.Response.ContentType = "application/json"; - await context.Response.WriteAsync(json); + await context.Response.WriteAsJsonAsync(result); } void SetUnAuthorizeResponse(Exception exception)