HttpClient中异常 ‘The format of value ‘application/json;charset=UTF-8‘ is invalid.
程序员文章站
2022-06-22 17:06:01
...
具体原因参考于17036
四种HttpContext实例
MultipartFormDataContent : multipart/form-data
FormUrlEncodedContent : application/x-www-form-urlencoded
StringContent : application/json 等
StreamContent : binary
设置示例
var content = new StringContent(param, Encoding.UTF8, "application/json");
content.Headers.ContentType.CharSet = "UTF-8";