We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
此版块专为反馈 bug 及提交需求服务,不负责解答开发问题,请勿发表开发问题, 如果您需要这方面的帮助,请移步问答社区:https://weixin.senparc.com/QA
问答社区
在 dotnet core 3 中,如果使用 Microsoft.AspNet.WebApi.Client 并使用 HttpClient 的 PostAsJsonAsync 扩展方法,Post 到服务端的数据不正确。
简单示例代码:
var client = new HttpClient(); var d = new { i = 0, t = 99 }; await client.PostAsJsonAsync("http://127.0.0.1", d);
服务端收到的数据是这样的:
POST / HTTP/1.1 Host: 127.0.0.1 Transfer-Encoding: chunked Content-Type: application/json; charset=utf-8 E {"i":0,"t":99} 0
类似问答
HttpClient PostAsJsonAsync behaving different in .NET Core and Classic .NET
HttpClient issue when calling older ASP.Net webAPIs from net core #232
该库已经很老了,已经不适用于 dotnet core 3.1,劳烦请移除。
Email:
(也可将问题地址及联系方式发送到 www.jeffrey.su@gmail.com)
发布问题后,请保持对 issue 的关注,有时会有需要进一步沟通的信息,很长时间内没有得到答复的 issue 将被关闭。
The text was updated successfully, but these errors were encountered:
我自己实现了个同名的扩展方法
public static Task<HttpResponseMessage> PostAsJsonAsync<T>(this HttpClient client, string requestUri, T value, CancellationToken cancellationToken = default) => client.PostAsync(requestUri, new StringContent(JsonConvert.SerializeObject(value), encoding, "application/json"), cancellationToken);
但,引用了 Microsoft.AspNet.WebApi.Client 后,被覆盖了。。。
Sorry, something went wrong.
@hetaoos 这个库目前没有实际用到,我发布了一个新版本的CO2NET,您可以先只更新这个库试一下(其他SDK等库应该都没用到):http://nuget.org/packages/Senparc.CO2NET
No branches or pull requests
问题描述
在 dotnet core 3 中,如果使用 Microsoft.AspNet.WebApi.Client 并使用 HttpClient 的 PostAsJsonAsync 扩展方法,Post 到服务端的数据不正确。
简单示例代码:
服务端收到的数据是这样的:
类似问答
HttpClient PostAsJsonAsync behaving different in .NET Core and Classic .NET
HttpClient issue when calling older ASP.Net webAPIs from net core #232
该库已经很老了,已经不适用于 dotnet core 3.1,劳烦请移除。
重现问题步骤(如果可以)
微信官方文档 URL
微信官方文档快照(直接复制关键内容到下方)
发现问题的模块
- [ ] Senparc.Weixin.QY 版本:模块对应的 .net 版本
开发环境
缓存环境
系统环境
联系方式
Email:
(也可将问题地址及联系方式发送到 www.jeffrey.su@gmail.com)
The text was updated successfully, but these errors were encountered: