Put content in HttpResponseMessage object?

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 with that data, but not anymore.

Now, you need to use the Content property to set the content of the message. The problem is that it is of type HttpContent, and I can’t seem to find a way to convert a string, for example, to HttpContent.

Does anyone know how to deal with this issue?
Thanks a lot.

8 Answers
8

Leave a Comment