mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 21:30:50 +08:00 
			
		
		
		
	This commit is contained in:
		@@ -222,6 +222,9 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
            _result.Data.ReRoute.DownstreamReRoute[0].LoadBalancerOptions.Type.ShouldBe(nameof(NoLoadBalancer));
 | 
			
		||||
            _result.Data.ReRoute.DownstreamReRoute[0].HttpHandlerOptions.ShouldBe(_handlerOptions);
 | 
			
		||||
            _result.Data.ReRoute.DownstreamReRoute[0].QosOptions.ShouldBe(_qoSOptions);
 | 
			
		||||
            _result.Data.ReRoute.UpstreamTemplatePattern.ShouldNotBeNull();
 | 
			
		||||
            _result.Data.ReRoute.DownstreamReRoute[0].UpstreamPathTemplate.ShouldNotBeNull();
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void ThenTheDownstreamPathIsForwardSlash()
 | 
			
		||||
 
 | 
			
		||||
@@ -48,19 +48,19 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                        .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                            .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("test", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("test", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .Build())
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                        .WithUpstreamTemplatePattern(new UpstreamPathTemplate("test", 1, false, "someUpstreamPath"))
 | 
			
		||||
                        .WithUpstreamPathTemplate(new UpstreamPathTemplate("test", 1, false, "someUpstreamPath"))
 | 
			
		||||
                        .Build(),
 | 
			
		||||
                    new ReRouteBuilder()
 | 
			
		||||
                        .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                            .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("test", 0, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("test", 0, false, "someUpstreamPath"))
 | 
			
		||||
                            .Build())
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                        .WithUpstreamTemplatePattern(new UpstreamPathTemplate("test", 0, false, "someUpstreamPath"))
 | 
			
		||||
                        .WithUpstreamPathTemplate(new UpstreamPathTemplate("test", 0, false, "someUpstreamPath"))
 | 
			
		||||
                        .Build()
 | 
			
		||||
                }, string.Empty, serviceProviderConfig))
 | 
			
		||||
                .And(x => x.GivenTheUrlMatcherReturns(new OkResponse<UrlMatch>(new UrlMatch(true))))
 | 
			
		||||
@@ -70,10 +70,10 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                        new ReRouteBuilder()
 | 
			
		||||
                            .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                .WithUpstreamTemplatePattern(new UpstreamPathTemplate("test", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("test", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("test", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("test", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                            .Build()
 | 
			
		||||
                        )))
 | 
			
		||||
@@ -94,19 +94,19 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                        .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                            .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("test", 0, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("test", 0, false, "someUpstreamPath"))
 | 
			
		||||
                            .Build())
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                        .WithUpstreamTemplatePattern(new UpstreamPathTemplate("test", 0, false, "someUpstreamPath"))
 | 
			
		||||
                        .WithUpstreamPathTemplate(new UpstreamPathTemplate("test", 0, false, "someUpstreamPath"))
 | 
			
		||||
                        .Build(),
 | 
			
		||||
                    new ReRouteBuilder()
 | 
			
		||||
                        .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                            .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("test", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("test", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .Build())
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                        .WithUpstreamTemplatePattern(new UpstreamPathTemplate("test", 1, false, "someUpstreamPath"))
 | 
			
		||||
                        .WithUpstreamPathTemplate(new UpstreamPathTemplate("test", 1, false, "someUpstreamPath"))
 | 
			
		||||
                        .Build()
 | 
			
		||||
                }, string.Empty, serviceProviderConfig))
 | 
			
		||||
                .And(x => x.GivenTheUrlMatcherReturns(new OkResponse<UrlMatch>(new UrlMatch(true))))
 | 
			
		||||
@@ -116,10 +116,10 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                        new ReRouteBuilder()
 | 
			
		||||
                            .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                .WithUpstreamTemplatePattern(new UpstreamPathTemplate("test", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("test", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("test", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("test", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                            .Build()
 | 
			
		||||
                        )))
 | 
			
		||||
@@ -141,10 +141,10 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                        .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                            .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .Build())
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                        .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                        .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                        .Build()
 | 
			
		||||
                }, string.Empty, serviceProviderConfig
 | 
			
		||||
                ))
 | 
			
		||||
@@ -158,10 +158,10 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                                .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                                    .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                    .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                    .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                    .Build())
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .Build()
 | 
			
		||||
                )))
 | 
			
		||||
                .And(x => x.ThenTheUrlMatcherIsCalledCorrectly())
 | 
			
		||||
@@ -183,10 +183,10 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                        .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                            .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .Build())
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                        .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                        .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                        .Build()
 | 
			
		||||
                }, string.Empty, serviceProviderConfig
 | 
			
		||||
                ))
 | 
			
		||||
@@ -200,10 +200,10 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                                .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                                    .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                    .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                    .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                    .Build())
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .Build()
 | 
			
		||||
                )))
 | 
			
		||||
                .And(x => x.ThenTheUrlMatcherIsCalledCorrectly("matchInUrlMatcher"))
 | 
			
		||||
@@ -226,10 +226,10 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                        .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                            .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .Build())
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                        .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                        .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                        .Build()
 | 
			
		||||
                }, string.Empty, serviceProviderConfig
 | 
			
		||||
                    ))
 | 
			
		||||
@@ -242,10 +242,10 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                            .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .Build()
 | 
			
		||||
                        )))
 | 
			
		||||
                .BDDfy();
 | 
			
		||||
@@ -267,19 +267,19 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                        .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                            .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .Build())
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                        .WithUpstreamTemplatePattern(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                        .WithUpstreamPathTemplate(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                        .Build(),
 | 
			
		||||
                    new ReRouteBuilder()
 | 
			
		||||
                        .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                            .WithDownstreamPathTemplate("someDownstreamPathForAPost")
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .Build())
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                        .WithUpstreamTemplatePattern(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                        .WithUpstreamPathTemplate(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                        .Build()
 | 
			
		||||
                }, string.Empty, serviceProviderConfig
 | 
			
		||||
                    ))
 | 
			
		||||
@@ -292,10 +292,10 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                            .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPathForAPost")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                                .WithUpstreamTemplatePattern(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .Build()
 | 
			
		||||
                        )))
 | 
			
		||||
                .BDDfy();
 | 
			
		||||
@@ -313,10 +313,10 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                        .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                                .WithDownstreamPathTemplate("somPath")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                .WithUpstreamTemplatePattern(new UpstreamPathTemplate("somePath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("somePath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .Build())
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                        .WithUpstreamTemplatePattern(new UpstreamPathTemplate("somePath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                        .WithUpstreamPathTemplate(new UpstreamPathTemplate("somePath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                        .Build(),   
 | 
			
		||||
                     }, string.Empty, serviceProviderConfig
 | 
			
		||||
                 ))
 | 
			
		||||
@@ -345,10 +345,10 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                        .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                            .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Get", "Post" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .Build())
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Get", "Post" })
 | 
			
		||||
                        .WithUpstreamTemplatePattern(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                        .WithUpstreamPathTemplate(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                        .Build()
 | 
			
		||||
                }, string.Empty, serviceProviderConfig
 | 
			
		||||
                    ))
 | 
			
		||||
@@ -361,10 +361,10 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                            .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                                .WithUpstreamTemplatePattern(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .Build()
 | 
			
		||||
                        )))
 | 
			
		||||
                .BDDfy();
 | 
			
		||||
@@ -386,10 +386,10 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                        .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                            .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string>())
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .Build())
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string>())
 | 
			
		||||
                        .WithUpstreamTemplatePattern(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                        .WithUpstreamPathTemplate(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                        .Build()
 | 
			
		||||
                }, string.Empty, serviceProviderConfig
 | 
			
		||||
                    ))
 | 
			
		||||
@@ -402,10 +402,10 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                            .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                                .WithUpstreamTemplatePattern(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .Build()
 | 
			
		||||
                        )))
 | 
			
		||||
                .BDDfy();
 | 
			
		||||
@@ -427,10 +427,10 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                        .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                            .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Get", "Patch", "Delete" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .Build())
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Get", "Patch", "Delete" })
 | 
			
		||||
                        .WithUpstreamTemplatePattern(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                        .WithUpstreamPathTemplate(new UpstreamPathTemplate("", 1, false, "someUpstreamPath"))
 | 
			
		||||
                        .Build()
 | 
			
		||||
                }, string.Empty, serviceProviderConfig
 | 
			
		||||
                    ))
 | 
			
		||||
@@ -458,11 +458,11 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                            .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamHost("MATCH")
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamHost("MATCH")
 | 
			
		||||
                            .Build()
 | 
			
		||||
                    }, string.Empty, serviceProviderConfig
 | 
			
		||||
@@ -477,10 +477,10 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                            .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .Build()
 | 
			
		||||
                    )))
 | 
			
		||||
                .And(x => x.ThenTheUrlMatcherIsCalledCorrectly())
 | 
			
		||||
@@ -503,10 +503,10 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                            .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .Build()
 | 
			
		||||
                    }, string.Empty, serviceProviderConfig
 | 
			
		||||
                ))
 | 
			
		||||
@@ -520,10 +520,10 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                            .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .Build()
 | 
			
		||||
                    )))
 | 
			
		||||
                .And(x => x.ThenTheUrlMatcherIsCalledCorrectly())
 | 
			
		||||
@@ -544,22 +544,22 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                            .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamHost("MATCH")
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamHost("MATCH")
 | 
			
		||||
                            .Build(),
 | 
			
		||||
                        new ReRouteBuilder()
 | 
			
		||||
                            .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { }) // empty list of methods
 | 
			
		||||
                                .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamHost("MATCH")
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { }) // empty list of methods
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamHost("MATCH")
 | 
			
		||||
                            .Build()
 | 
			
		||||
                    }, string.Empty, serviceProviderConfig
 | 
			
		||||
@@ -586,11 +586,11 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                            .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string>())
 | 
			
		||||
                                .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamHost("MATCH")
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string>())
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamHost("MATCH")
 | 
			
		||||
                            .Build()
 | 
			
		||||
                    }, string.Empty, serviceProviderConfig
 | 
			
		||||
@@ -617,11 +617,11 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                            .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string>())
 | 
			
		||||
                                .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamHost("MATCH")
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string>())
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamHost("MATCH")
 | 
			
		||||
                            .Build()
 | 
			
		||||
                    }, string.Empty, serviceProviderConfig
 | 
			
		||||
@@ -649,20 +649,20 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                            .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                                .WithDownstreamPathTemplate("THENULLPATH")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .Build(),
 | 
			
		||||
                        new ReRouteBuilder()
 | 
			
		||||
                            .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamHost("MATCH")
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                            .WithUpstreamHost("MATCH")
 | 
			
		||||
                            .Build()
 | 
			
		||||
                    }, string.Empty, serviceProviderConfig
 | 
			
		||||
@@ -677,10 +677,10 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                            .WithDownstreamReRoute(new DownstreamReRouteBuilder()
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "test"))
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "test"))
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                            .WithUpstreamTemplatePattern(new UpstreamPathTemplate("someUpstreamPath", 1, false, "test"))
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "test"))
 | 
			
		||||
                            .Build()
 | 
			
		||||
                    )))
 | 
			
		||||
                .And(x => x.ThenTheUrlMatcherIsCalledCorrectly(2))
 | 
			
		||||
 
 | 
			
		||||
@@ -56,7 +56,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
            var spConfig = new ServiceProviderConfigurationBuilder().WithHost("test").WithPort(50).WithType("test").Build();
 | 
			
		||||
            var reRoutes = new List<ReRoute>
 | 
			
		||||
            {
 | 
			
		||||
                new ReRouteBuilder().WithUpstreamTemplatePattern(new UpstreamPathTemplateBuilder().WithOriginalValue("woot").Build()).Build()
 | 
			
		||||
                new ReRouteBuilder().WithUpstreamPathTemplate(new UpstreamPathTemplateBuilder().WithOriginalValue("woot").Build()).Build()
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            this.Given(_ => GivenTheReRoutes(reRoutes, spConfig))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user