Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
        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());
        }
Ejemplo n.º 3
0
        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());
        }