Example #1
0
        /// <summary>
        /// execute the http request
        /// </summary>
        /// <param name="url"></param>
        /// <param name="data"></param>
        /// <param name="method"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static WebResponse GetRespByExecute(string url, object data, HttpMethod method, HttpContentType type)
        {
            switch (method)
            {
            case HttpMethod.GET:
                return(GetRespByExecuteRequest(url + "?" + ParamGeneratorFactory.GetParamGenerator(HttpContentType.FormData).GetParamString(data), type, null, method));

            case HttpMethod.POST:
            case HttpMethod.DELETE:
            case HttpMethod.PUT:
                return(GetRespByExecuteRequest(url, type, data, method));

            default:
                throw new Exception("No such http method");
            }
        }