From 6d5c3dee0d97798f70bf965e48c3a782b3df9e7d Mon Sep 17 00:00:00 2001
From: bklLiudl <673013083@qq.com>
Date: 星期三, 10 七月 2024 10:48:25 +0800
Subject: [PATCH] Merge branch 'hwh' into Liudl

---
 Wms/Utility/Filter/CustomerExceptionMiddleware.cs |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/Wms/Utility/Filter/CustomerExceptionMiddleware.cs b/Wms/Utility/Filter/CustomerExceptionMiddleware.cs
index f07c390..33fe7af 100644
--- a/Wms/Utility/Filter/CustomerExceptionMiddleware.cs
+++ b/Wms/Utility/Filter/CustomerExceptionMiddleware.cs
@@ -7,6 +7,7 @@
 using Microsoft.Extensions.Logging;
 using Utility.Entity;
 using Newtonsoft.Json;
+using System.Text;
 
 namespace Utility
 {
@@ -40,8 +41,10 @@
                         message: result,
                         data: result
                     );
-
-                await context.Response.WriteAsync(JsonConvert.SerializeObject(apiResponse));
+                var json = JsonConvert.SerializeObject(apiResponse);
+                context.Response.ContentType = "application/json";
+                context.Response.ContentLength = Encoding.UTF8.GetByteCount(json);
+                await context.Response.WriteAsync(json);
             }
         }
     }

--
Gitblit v1.8.0