Exemple #1
0
        public void GetCorsPolicyAsync_PathEndsWithSlash_NormalizesPathCorrectly()
        {
            var origin = "http://foo.com";

            var subject = new TestCorsPolicyProvider(new string[] { "bar/" });

            var cp = subject.GetCorsPolicyAsync(Request(origin, "/bar")).Result;

            AssertAllowed(origin, cp);
        }
Exemple #2
0
        public void GetCorsPolicyAsync_MatchingPaths_AllowsOrigin()
        {
            var origin = "http://foo.com";

            var subject = new TestCorsPolicyProvider(new string[] { "/bar", "/baz", "/quux" });

            var cp = subject.GetCorsPolicyAsync(Request(origin, "/baz")).Result;

            AssertAllowed(origin, cp);
        }
Exemple #3
0
        public void GetCorsPolicyAsync_NoMatchingPaths_DoesNotAllowOrigin()
        {
            var origin = "http://foo.com";

            var subject = new TestCorsPolicyProvider(new string[] { "/bar", "/baz", "/quux" });

            var cp = subject.GetCorsPolicyAsync(Request(origin, "/bad")).Result;

            cp.Should().BeNull();
        }
Exemple #4
0
        public void GetCorsPolicyAsync_NoOrigin_DoesNotAllowrigin()
        {
            string origin = null;
            var    path   = "/bar";

            var subject = new TestCorsPolicyProvider(new string[] { path });

            var cp = subject.GetCorsPolicyAsync(Request(origin, path)).Result;

            cp.Should().BeNull();
        }