Exemple #1
0
        /// <summary>
        /// Execute a HTTP request with optional POST stream. Returns HTTP response body as a stream.
        /// </summary>
        /// <param name="action"></param>
        /// <param name="queryParams"></param>
        /// <param name="postStream"></param>
        /// <returns></returns>
        protected virtual Stream GetStreamResponse(string action, Dictionary <string, string> queryParams, Stream postStream)
        {
            string url = string.Format(UrlFormat, BaseUrl, action, HttpTools.GetParamsAsQueryString(queryParams));

            if (postStream == null)
            {
                return(http.GetStream(url));
            }
            else
            {
                return(http.GetStream(url, postStream));
            }
        }
Exemple #2
0
        /// <summary>
        /// Execute a HTTP request with optional POST parameters. Returns a full HTTP response.
        /// </summary>
        /// <param name="action"></param>
        /// <param name="queryParams"></param>
        /// <param name="postParams"></param>
        /// <returns></returns>
        protected virtual HttpWebResponse GetFullResponse(string action, Dictionary <string, string> queryParams, Dictionary <string, string> postParams)
        {
            string url = string.Format(UrlFormat, BaseUrl, action, HttpTools.GetParamsAsQueryString(queryParams));

            if (postParams == null)
            {
                return(http.GetResponse(url));
            }
            else
            {
                return(http.GetResponse(url, postParams));
            }
        }