Пример #1
0
        public bool IsEndpointMatch(IRequestHandler requestHandler, HttpRequestHead request)
        {
            if (requestHandler.QueryParams == null)
                throw new ArgumentException("requestHandler QueryParams cannot be null");

            var requestQueryParams = GetQueryParams(request);

            bool uriStartsWith = request.Uri.StartsWith(requestHandler.Path);

            bool httpMethodsMatch = requestHandler.Method == request.Method;

            bool queryParamMatch = true;
            bool shouldMatchQueryParams = (requestHandler.QueryParams.Count > 0);

            if (shouldMatchQueryParams) {
                queryParamMatch = new QueryParamMatch().MatchQueryParams(requestHandler, requestQueryParams);
            }

            return uriStartsWith && httpMethodsMatch && queryParamMatch;
        }
Пример #2
0
        public bool IsEndpointMatch(IRequestHandler requestHandler, HttpRequestHead request)
        {
            if (requestHandler.QueryParams == null)
            {
                throw new ArgumentException("requestHandler QueryParams cannot be null");
            }

            var requestQueryParams = GetQueryParams(request);

            bool uriStartsWith = MatchPath(requestHandler, request);


            bool httpMethodsMatch = requestHandler.Method == request.Method;

            bool queryParamMatch        = true;
            bool shouldMatchQueryParams = (requestHandler.QueryParams.Count > 0);

            if (shouldMatchQueryParams)
            {
                queryParamMatch = new QueryParamMatch().MatchQueryParams(requestHandler, requestQueryParams);
            }

            return(uriStartsWith && httpMethodsMatch && queryParamMatch);
        }
Пример #3
0
 public EndpointMatchingRule()
 {
     _headerMatch     = new HeaderMatch();
     _queryParamMatch = new QueryParamMatch();
 }