Skip to content

Commit

Permalink
Merge pull request #95 from EasyAbp/improve-string-content
Browse files Browse the repository at this point in the history
Specify the encoding and media type of StringContent
  • Loading branch information
gdlcf88 authored Aug 10, 2023
2 parents ce08db0 + dd29b69 commit a8ccefc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 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>3.0.0-preview.5</Version>
<Version>3.0.0-preview.6</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,4 +1,5 @@
using System.Net.Http;
using System.Text;
using Newtonsoft.Json;

namespace EasyAbp.Abp.WeChat.MiniProgram.Models
Expand All @@ -7,8 +8,11 @@ public abstract class MiniProgramCommonRequest : IMiniProgramRequest
{
public virtual StringContent ToStringContent()
{
return new StringContent(JsonConvert.SerializeObject(this,
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }));
return new StringContent(
JsonConvert.SerializeObject(this,
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }),
Encoding.UTF8,
"application/json");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Net.Http;
using System.Text;
using Newtonsoft.Json;

namespace EasyAbp.Abp.WeChat.Official.Models
Expand All @@ -7,8 +8,11 @@ public abstract class OfficialCommonRequest : IOfficialRequest
{
public virtual StringContent ToStringContent()
{
return new StringContent(JsonConvert.SerializeObject(this,
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }));
return new StringContent(
JsonConvert.SerializeObject(this,
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }),
Encoding.UTF8,
"application/json");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Net.Http;
using System.Text;
using Newtonsoft.Json;

namespace EasyAbp.Abp.WeChat.OpenPlatform.Shared.Models;
Expand All @@ -7,7 +8,10 @@ public abstract class OpenPlatformCommonRequest : IOpenPlatformRequest
{
public virtual StringContent ToStringContent()
{
return new StringContent(JsonConvert.SerializeObject(this,
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }));
return new StringContent(
JsonConvert.SerializeObject(this,
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }),
Encoding.UTF8,
"application/json");
}
}

0 comments on commit a8ccefc

Please sign in to comment.