private static PomonaResponse ThrowMethodNotAllowedForType(HttpMethod requestMethod, HttpMethod allowedMethods) { var httpMethods = Enum.GetValues(typeof(HttpMethod)) .Cast<HttpMethod>() .Where(x => allowedMethods.HasFlag(x)) .Select(x => x.ToString().ToUpper()); var allowedMethodsString = String.Join(", ", httpMethods); var allowHeader = new KeyValuePair<string, string>("Allow", allowedMethodsString); throw new PomonaServerException( $"Method {requestMethod.ToString().ToUpper()} not allowed!", null, HttpStatusCode.MethodNotAllowed, allowHeader.WrapAsEnumerable()); }
private static PomonaResponse ThrowMethodNotAllowedForType(HttpMethod requestMethod, HttpMethod allowedMethods) { var httpMethods = Enum.GetValues(typeof(HttpMethod)) .Cast <HttpMethod>() .Where(x => allowedMethods.HasFlag(x)) .Select(x => x.ToString().ToUpper()); var allowedMethodsString = String.Join(", ", httpMethods); var allowHeader = new KeyValuePair <string, string>("Allow", allowedMethodsString); throw new PomonaServerException( $"Method {requestMethod.ToString().ToUpper()} not allowed!", null, HttpStatusCode.MethodNotAllowed, allowHeader.WrapAsEnumerable()); }
private void ThrowMethodNotAllowedForType(HttpMethod allowedMethods) { var allowedMethodsString = string.Join(", ", Enum.GetValues(typeof(HttpMethod)).Cast<HttpMethod>().Where(x => allowedMethods.HasFlag(x)).Select( x => x.ToString().ToUpper())); var allowHeader = new KeyValuePair<string, string>("Allow", allowedMethodsString); throw new PomonaException("Method " + Context.Request.Method + " not allowed!", null, HttpStatusCode.MethodNotAllowed, allowHeader.WrapAsEnumerable()); }