JinYazhou +

How to close Quote using WebApi

.net:
[Route("api/TestControllers/test")]
[HttpGet]
public HttpResponseMessage Test()
{
HttpResponseMessage responseMessage = new HttpResponseMessage { Content = new StringContent("你要返回的字符串", Encoding.GetEncoding("UTF-8"), "text/plain") };

return responseMessage;
}

.net core:
[Produces("text/plain")]

Before:
"{\"errcode\":40029,\"errmsg\":\"invalid code, hints: [ req_id: 1AMtoA0486th36 ]\"}"

After:
{"errcode":40029,"errmsg":"invalid code, hints: [ req_id: 5g8ILa0612th24 ]"}

最新评论