public LayerRequests(string url) { client = new RestClient(url); client.ClearHandlers(); client.AddHandler("application/json", new JsonDeserializer()); client.CookieContainer = RequestsHelper.GetCookieContainer(); }
public static CookieContainer GetCookieContainer() { var container = new CookieContainer(); var cookies = RequestsHelper.GetAllCookieList(); foreach (var c in cookies) { container.Add(GetCurrentDomain(), c); //container.Add(new Uri("http://localhost:2084"), c); } return(container); }
//private const string BaseUrl = @"http://localhost/API/"; public static void GetSuggestions(Action <List <String> > callback, string term) { var client = new RestClient(BaseUrl); client.ClearHandlers(); client.AddHandler("application/json", new JsonDeserializer()); client.CookieContainer = RequestsHelper.GetCookieContainer(); var request = new RestRequest("autocomplete"); request.AddParameter("term", term); client.ExecuteAsync <List <String> >(request, response => callback(response.Data)); }