嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 5 元微信扫码支付:5 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
Http接口测试工具
request = (HttpWebRequest)WebRequest.Create(txtUrl.Text.Trim()); //创建连接
request.Method = rdoPost.Checked ? "Post" : rdoPut.Checked?"Put":rdoGet.Checked?"Get":"DELETE"; //请求设置
if (rdoPost.Checked || (rdoPut.Checked && !string.IsNullOrWhiteSpace(txtRequ.Text))||(rdoDel.Checked&&!string.IsNullOrWhiteSpace(txtRequ.Text)))
{
byte[] by = Encoding.GetEncoding("utf-8").GetBytes(txtRequ.Text.Trim()); //请求参数转码
request.ContentType = txtContentType.Text.Trim();
request.ContinueTimeout = 500000;
request.ContentLength = by.Length;
Stream stw = request.GetRequestStream(); //获取绑定相应流
stw.Write(by, 0, by.Length); //写入流
stw.Close(); //关闭流
}
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); //返回流接收
st = response.GetResponseStream();
sr = new StreamReader(st, Encoding.GetEncoding("utf-8"));
result = sr.ReadToEnd(); //一次读完