Esempio n. 1
0
 /// <summary>Sets the request for the appropriate HTTP method based on the <see cref="OneAllMethod" />.</summary>
 /// <param name="request">The request.</param>
 /// <param name="method">The OneAll method.</param>
 internal static void SetHTTPMethod(this HttpWebRequest request, OneAllMethod method)
 {
     if (request != null && Enum.IsDefined(typeof(OneAllMethod), method))
     {
         switch (method)
         {
             case OneAllMethod.Invalid: { throw new ArgumentException(OneAllConstants.ERR_INVALID_HTTP_METHOD, OneAllConstants.PARAM_METHOD); };
             default: { request.Method = method.ToString().ToUpper(CultureInfo.InvariantCulture); } break;
         }
     }
     else { throw new ArgumentException(OneAllConstants.ERR_INVALID_HTTP_METHOD, OneAllConstants.PARAM_METHOD); }
 }
Esempio n. 2
0
        /// <summary>Sets the request for the appropriate HTTP method based on the <see cref="OneAllMethod" />.</summary>
        /// <param name="request">The request.</param>
        /// <param name="method">The OneAll method.</param>
        internal static void SetHTTPMethod(this HttpWebRequest request, OneAllMethod method)
        {
            if (request != null && Enum.IsDefined(typeof(OneAllMethod), method))
            {
                switch (method)
                {
                case OneAllMethod.Invalid: { throw new ArgumentException(OneAllConstants.ERR_INVALID_HTTP_METHOD, OneAllConstants.PARAM_METHOD); };

                default: { request.Method = method.ToString().ToUpper(CultureInfo.InvariantCulture); } break;
                }
            }
            else
            {
                throw new ArgumentException(OneAllConstants.ERR_INVALID_HTTP_METHOD, OneAllConstants.PARAM_METHOD);
            }
        }