Skip to content

Commit

Permalink
Merge pull request #64 from EasyAbp/response-utf8
Browse files Browse the repository at this point in the history
Specify response UTF-8 encoding name
  • Loading branch information
gdlcf88 committed Dec 25, 2022
2 parents 7693d4a + bbf1a34 commit aa3da7e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>2.0.0-rc.19</Version>
<Version>2.0.0-rc.20</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>EasyAbp Team</Authors>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EasyAbp.Abp.WeChat.Common;
using EasyAbp.Abp.WeChat.Common.RequestHandling.Dtos;
Expand All @@ -9,6 +10,7 @@
using JetBrains.Annotations;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Net.Http.Headers;
using Volo.Abp.AspNetCore.Mvc;

namespace EasyAbp.Abp.WeChat.OpenPlatform.Controllers;
Expand Down Expand Up @@ -81,17 +83,20 @@ public class WeChatThirdPartyPlatformController : AbpControllerBase
return BadRequest();
}

var contentType = result.ResponseToWeChatModel switch
var contentType = new MediaTypeHeaderValue(result.ResponseToWeChatModel switch
{
JsonResponseToWeChatModel => "application/json",
XmlResponseToWeChatModel => "text/xml",
null => "text/plain",
_ => "text/plain"
})
{
Charset = Encoding.UTF8.WebName
};

return new ContentResult
{
ContentType = contentType,
ContentType = contentType.ToString(),
Content = result.ResponseToWeChatModel?.Content ?? "success",
StatusCode = 200
};
Expand Down

0 comments on commit aa3da7e

Please sign in to comment.