Exemple #1
0
        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();
        }
Exemple #2
0
 public JContainer Put(Server server, string endpoint, string data)
 {
     Stream stream = MakeRequest(server, endpoint, "PUT", data);
     return GetResponseJson(stream);
 }
Exemple #3
0
 public JContainer Get(Server server, string endpoint)
 {
     Stream stream = MakeRequest(server, endpoint, "GET", string.Empty);
     return GetResponseJson(stream);
 }