Esempio n. 1
0
        public override int GetDestination(HttpContext httpContext)
        {
            var httpMethod = httpContext.Request.Method;

            if (_supportsCorsPreflight && HttpMethodMatcherPolicy.IsCorsPreflightRequest(httpContext, httpMethod, out var accessControlRequestMethod))
            {
                return(HttpMethods.Equals(accessControlRequestMethod, _method) ? _corsPreflightDestination : _corsPreflightExitDestination);
            }

            return(HttpMethods.Equals(httpMethod, _method) ? _destination : _exitDestination);
        }
        public override int GetDestination(HttpContext httpContext)
        {
            int destination;

            var httpMethod = httpContext.Request.Method;

            if (_supportsCorsPreflight && HttpMethodMatcherPolicy.IsCorsPreflightRequest(httpContext, httpMethod, out var accessControlRequestMethod))
            {
                return(_corsPreflightDestinations !.TryGetValue(accessControlRequestMethod.ToString(), out destination)
                    ? destination
                    : _corsPreflightExitDestination);
            }

            return(_destinations != null &&
                   _destinations.TryGetValue(httpMethod, out destination) ? destination : _exitDestination);
        }