public static void AddNewtonsoftResponseHandler(this IRestClient restClient, NewtonsoftRestsharpJsonSerializer serializer) { string[] contentTypes = new string[] { "application/json", "text/json", "text/x-json", "text/javascript", "*+json" }; foreach (var contentType in contentTypes) { restClient.AddHandler(contentType, serializer); } }
public static void AddNewtonsoftHandler(this IRestClient restClient, IRestRequest restRequest, NewtonsoftRestsharpJsonSerializer serializer) { restClient.AddNewtonsoftResponseHandler(serializer); restRequest.AddNewtonsoftRequestHandler(serializer); }
public static void AddNewtonsoftRequestHandler(this IRestRequest restRequest, NewtonsoftRestsharpJsonSerializer serializer) { restRequest.RequestFormat = DataFormat.Json; restRequest.JsonSerializer = serializer; }