此主题相关图片如下:企业微信截图_17143765249878.png
使用调试工具,正常获到数据,必须要有Content-Length请求头,
我在foxtable中添加的这个请求头返回还是和未加一样的错误【远程服务器返回错误: (411) 所需的长度。】 这个怎么写?
hc.Headers.Add("Content-Length", "31")
hc.Method = "POST"
Dim jo As New JObject
jo("userId") = "test"
hc.Content = jo.ToString
jo = JObject.Parse(hc.GetData)
Output.Show(jo.ToString)
此主题相关图片如下:企业微信截图_17143769832207.png
Dim hc As New HttpClient("http://test/openapi/UserInfo/GetInfoById")
hc.Method = "POST"
Dim jo As New JObject
jo("userId") = "test"
hc.Content = jo.ToString
jo = JObject.Parse(hc.GetData)
Output.Show(jo.ToString)
[此贴子已经被作者于2024/4/30 14:47:23编辑过]
[此贴子已经被作者于2024/4/30 16:36:48编辑过]
没有添加 认证参数
Dim hc As New HttpClient("http://www.abc.com:8001/openapi/UserInfo/GetInfoById?AppId=xxx&AppSecret=xxx")
[此贴子已经被作者于2024/4/30 16:40:40编辑过]
using HttpClient httpClient = new(); Dictionary<string, object> data = new()
{
["userId"] = "test"
};
using StringContent stringContent = new(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json");
HttpResponseMessage httpResponseMessage = httpClient.PostAsync("http://test/openapi/UserInfo/GetInfoById", stringContent).Result;
if (httpResponseMessage.IsSuccessStatusCode)
{
string result = httpResponseMessage.Content.ReadAsStringAsync().Result;
}
他们给了这个,蓝大人请看一下
[此贴子已经被作者于2024/4/30 14:47:48编辑过]
那和3楼的用法没有什么区别,也没看到有设置怎么什么
Content-Length