/// <summary> /// Checks web request method type /// </summary> public static bool IsMethod(string method, DefaultMethods methodType) { if (method == null) return false; string t = methodType.ToString().ToLower(); if (method.Trim().ToLower() == t) return true; else return false; }
/// <summary> /// Checks web request method type /// </summary> public static bool IsMethod(string method, DefaultMethods methodType) { if (method == null) { return(false); } string t = methodType.ToString().ToLower(); if (method.Trim().ToLower() == t) { return(true); } else { return(false); } }
public static string ValidateMethod(string method, DefaultMethods defaultMethod) { if (method == null) { return(method); } string testMethod = method.Trim().ToUpper(); if (testMethod == GET) { return(method); } else if (testMethod == POST) { return(method); } else if (testMethod == PUT) { return(method); } else if (testMethod == DELETE) { return(method); } else if (testMethod == TRACE) { return(method); } else if (testMethod == CONNECT) { return(method); } else if (testMethod == OPTIONS) { return(method); } else { return(defaultMethod.ToString()); } }
/// <summary> /// Detects method by starting characters /// </summary> public static string DetectMethod(string method, DefaultMethods defaultMethods) { if (method == null) { return(method); } string testMethod = method.Trim().ToUpper(); if (GET.StartsWith(testMethod)) { return(GET); } else if (POST.StartsWith(testMethod)) { return(POST); } else if (PUT.StartsWith(testMethod)) { return(PUT); } else if (DELETE.StartsWith(testMethod)) { return(DELETE); } else if (TRACE.StartsWith(testMethod)) { return(TRACE); } else if (CONNECT.StartsWith(testMethod)) { return(CONNECT); } else if (OPTIONS.StartsWith(testMethod)) { return(OPTIONS); } else { return(defaultMethods.ToString()); } }
/// <summary> /// Detects method by starting characters /// </summary> public static string DetectMethod(string method, DefaultMethods defaultMethods) { if (method == null) return method; string testMethod = method.Trim().ToUpper(); if (GET.StartsWith(testMethod)) return GET; else if (POST.StartsWith(testMethod)) return POST; else if (PUT.StartsWith(testMethod)) return PUT; else if (DELETE.StartsWith(testMethod)) return DELETE; else if (TRACE.StartsWith(testMethod)) return TRACE; else if (CONNECT.StartsWith(testMethod)) return CONNECT; else if (OPTIONS.StartsWith(testMethod)) return OPTIONS; else return defaultMethods.ToString(); }
public static string ValidateMethod(string method, DefaultMethods defaultMethod) { if (method == null) return method; string testMethod = method.Trim().ToUpper(); if (testMethod == GET) return method; else if (testMethod == POST) return method; else if (testMethod == PUT) return method; else if (testMethod == DELETE) return method; else if (testMethod == TRACE) return method; else if (testMethod == CONNECT) return method; else if (testMethod == OPTIONS) return method; else return defaultMethod.ToString(); }