コード例 #1
0
        /// <summary>
        /// 请求
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="url">url地址</param>
        /// <param name="method">方法</param>
        /// <param name="paramObj">参数</param>
        /// <param name="headerObj">头部参数</param>
        /// <returns></returns>
        public IRestResponse Execute(string url, Method method, object paramObj = null, IDictionary <string, string> headerObj = null)
        {
            //请求上线文
            var request = new RestRequestEx(url, method, new NewtonsoftJsonSerializer());

            //添加参数
            RestRequestWithParam(request, method, paramObj);

            //添加头部参数
            RestRequestWithHeader(request, headerObj);

            //请求
            var res = this.client.Execute(request);

            return(res);
        }