/// <summary> /// 以Get方式获取数据 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="jsonSerializer">json序列化</param> /// <param name="url">请求url</param> /// <param name="requestPara">请求参数集合.</param> /// <param name="headerParams">放在header参数.</param> /// <param name="timeout">过期时间,以毫秒为单位</param> /// <returns></returns> public virtual T Get <T>(IJsonSerializer jsonSerializer, UrlConcat url, IDictionary <string, string> requestPara, IDictionary <string, string> headerParams, int timeout = 30000) { var txt = new HttpRequestDownloader().GetString(url.ToString(), requestPara, headerParams, "application/json", timeout); if (txt.IsNullOrEmpty()) { return(default(T)); } return(jsonSerializer.Deserialize <T>(txt)); }
/// <summary> /// 以Post方式获取数据 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="jsonSerializer">json序列化</param> /// <param name="url">参数请求</param> /// <param name="jsonDate">json请求内容</param> /// <param name="headerParams">放在header参数.</param> /// <param name="timeout">过期时间,以毫秒为单位</param> /// <returns></returns> public virtual T Post <T>(IJsonSerializer jsonSerializer, UrlConcat url, string jsonDate, IDictionary <string, string> headerParams, int timeout = 30000) { var txt = new HttpRequestDownloader().JPostString(url.ToString(), jsonDate, headerParams, timeout); if (txt.IsNullOrEmpty()) { return(default(T)); } return(jsonSerializer.Deserialize <T>(txt)); }
/// <summary> /// 以Get方式获取数据 /// </summary> /// <param name="jsonSerializer">json序列化</param> /// <param name="url">请求url</param> /// <param name="requestPara">请求参数集合.</param> /// <param name="headerParams">放在header参数.</param> /// <param name="timeout">过期时间,以毫秒为单位</param> /// <returns></returns> public virtual void Get(IJsonSerializer jsonSerializer, UrlConcat url, IDictionary <string, string> requestPara, IDictionary <string, string> headerParams, int timeout = 30000) { new HttpRequestDownloader().GetString(url.ToString(), requestPara, headerParams, "application/json", timeout); }
/// <summary> /// 以Post方式获取数据 /// </summary> /// <param name="jsonSerializer">json序列化</param> /// <param name="url">参数请求</param> /// <param name="jsonDate">json请求内容</param> /// <param name="headerParams">放在header参数.</param> /// <param name="timeout">过期时间,以毫秒为单位</param> /// <returns></returns> public virtual void Post(IJsonSerializer jsonSerializer, UrlConcat url, string jsonDate, IDictionary <string, string> headerParams, int timeout = 30000) { new HttpRequestDownloader().JPostString(url.ToString(), jsonDate, headerParams, timeout); }