force json mime type to application/json in json response

Discussion created by eliprandi on Oct 24, 2012
Latest reply on Oct 24, 2012 by rlwatson
I have read several threads on these forums that sort of explained how to set the Content-Type on a REST response for a .NET SOE. However, I am batting .000 in making this work. The most basic example I want to get working is to use the VS2010 project template for a REST SOE. All I want is force Content-Type header to be application/json instead of the "text/plain;charset=utf-8" that it defaults to.
I have tried the following in SampleOperHandler:
            RestResponseProperties props = new RestResponseProperties();
            props.ContentType = "application/json";
            responseProperties = props.ToString();

also tried the following:
            responseProperties = "{\"Content-Type\": \"application/json\"}";

In either case, the Content-Type Header is not updated to my value. What are we missing? According to RFC 4627, the MIME type for JSON text is application/json. Some of our tools and systems are requiring proper semantics and we need to be able to overwrite this.