Exemple #1
0
        public async Task <bool> IsIdempotentAsync(string method, string path)
        {
            var rules = await iclCache.GetAsync().ConfigureAwait(false);

            //We are assume here that last rule is always {* * Idempotent}. See IclCache.
            if (rules.Count > 1 && path.StartsWith("/"))
            {
                path = path.TrimStart('/');
            }

            var matchedRule = rules.First(r => PathPatternRuleMatcher.IsMatch(r, method, path));

            return(matchedRule.IsIdempotent);
        }
        public bool IsIdempotent(string method, string path)
        {
            var rules = iclCache.Get();

            //We are assume here that last rule is always {* * Idempotent}. See IclCache.
            if (rules.Count > 1 && path.StartsWith("/"))
            {
                path = path.TrimStart('/');
            }

            var matchedRule = rules.First(r => PathPatternRuleMatcher.IsMatch(r, method, path));

            return(matchedRule.IsIdempotent);
        }
 public void Should_match_paths_with_special_symbols(string method, string path)
 {
     rules.Count(r => PathPatternRuleMatcher.IsMatch(r, method, path)).Should().BeGreaterThan(0);
 }
 public void IsMatch_Should_Math_When_TestCases(IdempotencyControlRule rule, string method, string path, bool expected)
 {
     PathPatternRuleMatcher.IsMatch(rule, method, path).Should().Be(expected);
 }