private Stream MakeRequest(Server server, string endpoint, string verb, string data) { var request = (HttpWebRequest)WebRequest.Create(string.Format("http://{0}:{1}/{2}", server.Host, server.Port, endpoint)); request.Method = verb; if(!string.IsNullOrEmpty(data)) WriteData(request.GetRequestStream(), data); var response = (HttpWebResponse)request.GetResponse(); return response.GetResponseStream(); }
public JContainer Put(Server server, string endpoint, string data) { Stream stream = MakeRequest(server, endpoint, "PUT", data); return GetResponseJson(stream); }
public JContainer Get(Server server, string endpoint) { Stream stream = MakeRequest(server, endpoint, "GET", string.Empty); return GetResponseJson(stream); }