I use the following method to create an HttpResponseMessage object and return it via my Web API project:
public HttpResponseMessage CreateHttpResponseMessage(string message, HttpStatusCode httpStatusCode)
{
var stringContent = new StringContent(message, new UTF8Encoding(), "application/javascript");
return new HttpResponseMessage(httpStatusCode)
{
Content = stringContent
};
}
I'm using this to return a jsonp payload however it keeps returning with content type text/plain and not application/javascript. This is causing the browser console to log this warning:
Resource interpreted as Script but transferred with MIME type text/plain
The message I'm returning isn't null or empty and therefore I'm confused as to why it's behaving this way.