c# 后台调用msgSecCheck验证文本内容安全,返回值
{strategy: "keyword",errcode: 0,strategy: "keyword",errcode: 0,strategy: "keyword",errcode: 0,
strategy: "content_model",errcode: 0,errcode: 0,errmsg: "ok",trace_id: "63b53f64-539c0acd-132f3c5d",
detail: [{strategy: "content_model",
errcode: 0,strategy: "content_model",errcode: 0,strategy: "keyword",errcode: 0,strategy: "keyword",
errcode: 0,strategy: "content_model",errcode: 0,suggest: "pass",label: 100,prob: 90,},
{strategy: "keyword",errcode: 0,},],
result: {suggest: "pass",label: 100,},}
使用的测试词条如下(官方给的测试用例),始终都是通过,
#代码如下:
byte[] bytes = Encoding.Default.GetBytes(body.content);
string content = Encoding.UTF8.GetString(bytes);
Dictionary<string, object> par = new Dictionary<string, object>
{ { "openid",d.openId},{ "scene",4}, { "version",2}, { "content",content} };
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.ContentType = "application/json; charset=UTF-8";
StringBuilder builder = new StringBuilder();
builder.Append(JsonHelper.SerializeJson(par));
byte[] data = Encoding.UTF8.GetBytes(builder.ToString());
req.ContentLength = data.Length;
using (Stream reqStream = req.GetRequestStream())
{
reqStream.Write(data, 0, data.Length);
reqStream.Close();
}
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Stream stream = resp.GetResponseStream();
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{
backMsg = reader.ReadToEnd();
}
奇怪的很
没看见词条在哪
过滤掉了,用的是链接中的测试用例
用 ”他是个大傻逼“ 还是一如既往的通过,我也是醉了,不知道是什么原因