Browse Source
Merge pull request #12106 from abpframework/exception-handling-content-type
Exception handling: Specify json as Content-Type in response header
pull/12107/head
Halil İbrahim Kalkan
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
1 additions and
0 deletions
-
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( |
|
|
|
|