我正在通过 webhook 集成将数据发送到松弛通道。但是,当我包含换行符(\n)时,我得到了 http 500。当我对换行符进行 url 编码时,我看到了编码值,而不是 slacn 中的真正换行符
string body = "foo"
if(!string.IsNullOrWhiteSpace(feedEntry.Link ))
{
body += " \n <" + feedEntry.Link +">";
}
body = "{\"text\": \"" + body+ "\"}";
using(var client = new HttpClient())
{
var msg = new StringContent(body);
var result = await client.PostAsync(url, msg);
}