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); }
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(); }
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); }
public void GetCorsPolicyAsync_MatchingPath_AllowsOrigin() { var origin = "http://foo.com"; var path = "/bar"; var subject = new TestCorsPolicyProvider(new string[] { path }); var cp = subject.GetCorsPolicyAsync(Request(origin, path)).Result; AssertAllowed(origin, cp); }
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(); }