JSONP Formatter

May 9, 2013 at 5:42 PM
Edited May 9, 2013 at 5:44 PM
Consider updating your JsonpFormatter to the latest version that leverages your existing JsonFormatter (from the README):
public class FormatterConfig
    public static void RegisterFormatters(MediaTypeFormatterCollection formatters)
        var jsonFormatter = formatters.JsonFormatter;
        jsonFormatter.SerializerSettings = new JsonSerializerSettings
            ContractResolver = new CamelCasePropertyNamesContractResolver()

        // Insert the JSONP formatter in front of the standard JSON formatter.
        var jsonpFormatter = new JsonpMediaTypeFormatter(formatters.JsonFormatter);
        formatters.Insert(0, jsonpFormatter);
The previous design created a new formatter for each request, while the new formatter leverages the existing JSON formatter for all requests and only creates a new request-specific wrapper.