From acd72686b40d091d319e50b217b5bf7dc7930261 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Mon, 28 Mar 2022 14:40:52 +0300 Subject: [PATCH] Exception handling: Specify json as Content-Type in response header --- .../ExceptionHandling/AbpExceptionHandlingMiddleware.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs index 48ec6121b4..b9d3b83068 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs @@ -82,6 +82,7 @@ public class AbpExceptionHandlingMiddleware : IMiddleware, ITransientDependency httpContext.Response.StatusCode = (int)statusCodeFinder.GetStatusCode(httpContext, exception); httpContext.Response.OnStarting(_clearCacheHeadersDelegate, httpContext.Response); httpContext.Response.Headers.Add(AbpHttpConsts.AbpErrorFormat, "true"); + httpContext.Response.Headers.Add("Content-Type", "application/json"); await httpContext.Response.WriteAsync( jsonSerializer.Serialize(