提交 84a95e65 编写于 作者: S szjay

增加HttpHelper.Get

上级 2e3d47a8
......@@ -41,5 +41,26 @@ namespace Infrastructure.Utilities
var result = new StreamReader(response.GetResponseStream()).ReadToEnd();
return result;
}
public static string Get(string url)
{
return Get(url, "");
}
public static string Get(string url, string args)
{
url = args.IsNullOrEmpty() ? url : url + "?" + args;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.ContentType = "application/json";
request.Method = "GET";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream myResponseStream = response.GetResponseStream();
StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.UTF8);
string result = myStreamReader.ReadToEnd();
myStreamReader.Close();
myResponseStream.Close();
return result;
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册