HttpResponseMessage没有返回内容吗?

时间:2018-08-24 19:29:27

标签: c# asp.net-core

我正在使用asp.net core 2.1,WebAPI中有一个http post方法,如下所示:

[HttpPost]
public HttpResponseMessage AddNews(News news)
{
    return new HttpResponseMessage(HttpStatusCode.OK) 
    {
        Content = new StringContent("okkkkk") 
    };
}

但是当调用此API时,在Chrome网络中,我只能看到以下响应,而找不到我的“ okkkk”内容。

请问我的代码有什么问题?

{"version":{"major":1,"minor":1,"build":-1,"revision":-1,"majorRevision":-1,"minorRevision":-1},"content":{"headers":[{"key":"Content-Type","value":["application/json; charset=utf-8"]}]},"statusCode":200,"reasonPhrase":"OK","headers":[],"requestMessage":null,"isSuccessStatusCode":true}

0 个答案:

没有答案