Put content in HttpResponseMessage object?

后端 未结 8 1516
感情败类
感情败类 2020-11-28 03:31

Several months ago, Microsoft decided to change up the HttpResponseMessage class. Before, you could simply pass a data type into the constructor, and then return the message

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-28 03:57

    For any T object you can do:

    return Request.CreateResponse(HttpStatusCode.OK, Tobject);
    

提交回复
热议问题