As we know by default, Web API framework has formatters that can produce JSON or XML If you want to produce some other types of output, then in many places i've read it is required to implement custom media type formatter that will do what you want. But f.e. i need to return raw HTML from my Web API controller, and if i create HttpResponseMessage this way:
response = new HttpResponseMessage()
{
Content = new StringContent(
"<p>Hello world</p>",
Encoding.UTF8,
"text/html")
};
Then I have raw HTML in my response that browser will recognize and render. My question actually Why it is works without using any custom formatter, and in which case i need to create one, and in which I shouldn't.