Exemple #1
0
        /// <summary>
        /// RestSharp同步请求
        /// </summary>
        /// <param name="Url">请求地址</param>
        /// <param name="prament">请求参数</param>
        /// <param name="methoh">请求方式(GET, POST, PUT, HEAD, OPTIONS, DELETE)</param>
        /// <returns>返回的是List<string>数据</returns>
        public static List <String> ReturnResults(String Url, String prament, Method methoh)
        {
            var client = new RestSharpClient(Url);

            LogHelper.Info("请求地址:" + Url + prament);
            var result = client.Execute <List <String> >(new RestRequest(prament, methoh));

            return(result);
        }
Exemple #2
0
        /// <summary>
        /// RestSharp通用执行方法
        /// </summary>
        /// <param name="Url">请求地址</param>
        /// <param name="prament">请求参数</param>
        /// <param name="methoh">请求方式(GET, POST, PUT, HEAD, OPTIONS, DELETE)</param>
        /// <returns>返回的是string数据</returns>
        public static String ReturnResult(String Url, String prament, Method methoh)
        {
            var client = new RestSharpClient(Url);

            LogHelper.Info("请求地址:" + Url + prament);
            var result = client.Execute(new RestRequest(prament, methoh));

            return(result.Content);//返回的字符串数据
        }