Exemplo n.º 1
0
 /// <summary>
 /// i will Send Data
 /// </summary>
 /// <param name="url"> url </param>
 /// <param name="data"> param if method is not POST it will add to the url</param>
 /// <param name="method">GET/POST</param>
 /// <param name="myAht">the myAutoHttpTest will fill the data</param>
 /// <returns>back </returns>
 public void SendData(string url, string data, string method, List <KeyValuePair <string, string> > heads, MyExecutionDeviceResult myEdr)
 {
     MyWebTool.MyHttpResponse httpResponse = myHttp.SendHttpRequest(url, data, method, heads, myHttp.IsWithDefaultCookieContainer, null, null);
     myEdr.backContent = isShowRawResponse ? httpResponse.ResponseRaw : httpResponse.ResponseBody;
     MyWebTool.HttpTimeLine timeline = httpResponse.TimeLine ?? new MyWebTool.HttpTimeLine();
     myEdr.startTime   = timeline.StartTime.ToString("HH:mm:ss");
     myEdr.requestTime = myEdr.spanTime = timeline.ElapsedTime.ToString();
 }
Exemplo n.º 2
0
 public static void DotestForMyhttps()
 {
     MyWebTool.MyHttp.EnableServerCertificateValidation = true;
     MyWebTool.MyHttp myHttp = new MyWebTool.MyHttp(false, true);
     //https://iuc.oppomobile.com/account/user-info
     MyCommonHelper.NetHelper.MyWebTool.MyHttpResponse myHttpResponse = myHttp.SendHttpRequest(@"https://lijie.com/hello", null, "GET", null, false, null, null);
     Console.WriteLine(myHttpResponse.ResponseRaw ?? myHttpResponse.ErrorMes);
     myHttpResponse = myHttp.SendHttpRequest(@"https://iuc.oppomobile.com/account/user-info", null, "GET", null, false, null, null);
     Console.WriteLine(myHttpResponse.ResponseRaw ?? myHttpResponse.ErrorMes);
     //Console.WriteLine(myHttp.SendData(@"https://api.weixin.qq.com/sns/oauth2/access_token?code=061v6AGK1pOTj40nF0EK1LNwGK1v6AGV&grant_type=authorization_code&appid=wx01f2ab6d9e41169a&secret=1d2f3f1bdd6b2790b48ae64c8bc9bfdb"));
 }