mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 15:10:50 +08:00 
			
		
		
		
	UpstreamHttpMethod property (of class FileReRoute) changes from string to List<string>.
This commit is contained in:
		@@ -72,7 +72,7 @@ namespace Ocelot.UnitTests.Authentication
 | 
			
		||||
        public void should_call_next_middleware_if_route_is_not_authenticated()
 | 
			
		||||
        {
 | 
			
		||||
            this.Given(x => x.GivenTheDownStreamRouteIs(new DownstreamRoute(new List<UrlPathPlaceholderNameAndValue>(), new ReRouteBuilder()
 | 
			
		||||
                                                                                                                            .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                                                                                                                            .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                                                                                                            .Build())))
 | 
			
		||||
                .When(x => x.WhenICallTheMiddleware())
 | 
			
		||||
                .Then(x => x.ThenTheUserIsAuthenticated())
 | 
			
		||||
 
 | 
			
		||||
@@ -66,7 +66,7 @@ namespace Ocelot.UnitTests.Authorization
 | 
			
		||||
            this.Given(x => x.GivenTheDownStreamRouteIs(new DownstreamRoute(new List<UrlPathPlaceholderNameAndValue>(), 
 | 
			
		||||
                new ReRouteBuilder()
 | 
			
		||||
                    .WithIsAuthorised(true)
 | 
			
		||||
                    .WithUpstreamHttpMethod("Get")                                                                                                                                                                    .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                    .Build())))
 | 
			
		||||
                .And(x => x.GivenTheAuthServiceReturns(new OkResponse<bool>(true)))
 | 
			
		||||
                .When(x => x.WhenICallTheMiddleware())
 | 
			
		||||
 
 | 
			
		||||
@@ -91,7 +91,7 @@ namespace Ocelot.UnitTests.Cache
 | 
			
		||||
            var reRoute = new ReRouteBuilder()
 | 
			
		||||
                .WithIsCached(true)
 | 
			
		||||
                .WithCacheOptions(new CacheOptions(100))
 | 
			
		||||
                .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                .Build();
 | 
			
		||||
                
 | 
			
		||||
            var downstreamRoute = new DownstreamRoute(new List<UrlPathPlaceholderNameAndValue>(), reRoute);
 | 
			
		||||
 
 | 
			
		||||
@@ -72,7 +72,7 @@ namespace Ocelot.UnitTests.Claims
 | 
			
		||||
                    {
 | 
			
		||||
                        new ClaimToThing("sub", "UserType", "|", 0)
 | 
			
		||||
                    })
 | 
			
		||||
                    .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                    .Build());
 | 
			
		||||
 | 
			
		||||
            this.Given(x => x.GivenTheDownStreamRouteIs(downstreamRoute))
 | 
			
		||||
 
 | 
			
		||||
@@ -84,7 +84,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
                                    DownstreamHost = "127.0.0.1",
 | 
			
		||||
                                    UpstreamPathTemplate = "/api/products/{productId}",
 | 
			
		||||
                                    DownstreamPathTemplate = "/products/{productId}",
 | 
			
		||||
                                    UpstreamHttpMethod = "Get",
 | 
			
		||||
                                    UpstreamHttpMethod = new List<string> { "Get" },
 | 
			
		||||
                                }
 | 
			
		||||
                            },
 | 
			
		||||
            }))
 | 
			
		||||
@@ -117,7 +117,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
                        DownstreamHost = "127.0.0.1",
 | 
			
		||||
                        UpstreamPathTemplate = "/api/products/{productId}",
 | 
			
		||||
                        DownstreamPathTemplate = "/products/{productId}",
 | 
			
		||||
                        UpstreamHttpMethod = "Get",
 | 
			
		||||
                        UpstreamHttpMethod = new List<string> { "Get" },
 | 
			
		||||
                        QoSOptions = new FileQoSOptions
 | 
			
		||||
                        {
 | 
			
		||||
                            TimeoutValue = 1,
 | 
			
		||||
@@ -153,7 +153,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
                                        DownstreamHost = "127.0.0.1",
 | 
			
		||||
                                        UpstreamPathTemplate = "/api/products/{productId}",
 | 
			
		||||
                                        DownstreamPathTemplate = "/products/{productId}",
 | 
			
		||||
                                        UpstreamHttpMethod = "Get",
 | 
			
		||||
                                        UpstreamHttpMethod = new List<string> { "Get" },
 | 
			
		||||
                                    }
 | 
			
		||||
                                },
 | 
			
		||||
                            }))
 | 
			
		||||
@@ -181,7 +181,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
                                    DownstreamHost = "127.0.0.1",
 | 
			
		||||
                                    UpstreamPathTemplate = "/api/products/{productId}",
 | 
			
		||||
                                    DownstreamPathTemplate = "/products/{productId}",
 | 
			
		||||
                                    UpstreamHttpMethod = "Get",
 | 
			
		||||
                                    UpstreamHttpMethod = new List<string> { "Get" },
 | 
			
		||||
                                }
 | 
			
		||||
                            },
 | 
			
		||||
                        }))
 | 
			
		||||
@@ -194,7 +194,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
                                    .WithDownstreamHost("127.0.0.1")
 | 
			
		||||
                                    .WithDownstreamPathTemplate("/products/{productId}")
 | 
			
		||||
                                    .WithUpstreamPathTemplate("/api/products/{productId}")
 | 
			
		||||
                                    .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                    .Build()
 | 
			
		||||
                            }))
 | 
			
		||||
                .BDDfy();
 | 
			
		||||
@@ -215,7 +215,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
                                                    DownstreamScheme = "https",
 | 
			
		||||
                                                    UpstreamPathTemplate = "/api/products/{productId}",
 | 
			
		||||
                                                    DownstreamPathTemplate = "/products/{productId}",
 | 
			
		||||
                                                    UpstreamHttpMethod = "Get",
 | 
			
		||||
                                                    UpstreamHttpMethod = new List<string> { "Get" },
 | 
			
		||||
                                                }
 | 
			
		||||
                                            },
 | 
			
		||||
                                        }))
 | 
			
		||||
@@ -228,7 +228,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
                                                    .WithDownstreamScheme("https")
 | 
			
		||||
                                                    .WithDownstreamPathTemplate("/products/{productId}")
 | 
			
		||||
                                                    .WithUpstreamPathTemplate("/api/products/{productId}")
 | 
			
		||||
                                                    .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                                                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                                    .Build()
 | 
			
		||||
                                            }))
 | 
			
		||||
                                .BDDfy();
 | 
			
		||||
@@ -248,7 +248,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
                                {
 | 
			
		||||
                                    UpstreamPathTemplate = "/api/products/{productId}",
 | 
			
		||||
                                    DownstreamPathTemplate = "/products/{productId}",
 | 
			
		||||
                                    UpstreamHttpMethod = "Get",
 | 
			
		||||
                                    UpstreamHttpMethod = new List<string> { "Get" },
 | 
			
		||||
                                    ReRouteIsCaseSensitive = false,
 | 
			
		||||
                                    ServiceName = "ProductService"
 | 
			
		||||
                                }
 | 
			
		||||
@@ -270,7 +270,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
                                new ReRouteBuilder()
 | 
			
		||||
                                    .WithDownstreamPathTemplate("/products/{productId}")
 | 
			
		||||
                                    .WithUpstreamPathTemplate("/api/products/{productId}")
 | 
			
		||||
                                    .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                    .WithServiceProviderConfiguraion(new ServiceProviderConfigurationBuilder()
 | 
			
		||||
                                        .WithUseServiceDiscovery(true)
 | 
			
		||||
                                        .WithServiceDiscoveryProvider("consul")
 | 
			
		||||
@@ -296,7 +296,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
                                {
 | 
			
		||||
                                    UpstreamPathTemplate = "/api/products/{productId}",
 | 
			
		||||
                                    DownstreamPathTemplate = "/products/{productId}",
 | 
			
		||||
                                    UpstreamHttpMethod = "Get",
 | 
			
		||||
                                    UpstreamHttpMethod = new List<string> { "Get" },
 | 
			
		||||
                                    ReRouteIsCaseSensitive = false,
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
@@ -309,7 +309,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
                                new ReRouteBuilder()
 | 
			
		||||
                                    .WithDownstreamPathTemplate("/products/{productId}")
 | 
			
		||||
                                    .WithUpstreamPathTemplate("/api/products/{productId}")
 | 
			
		||||
                                    .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                    .WithServiceProviderConfiguraion(new ServiceProviderConfigurationBuilder()
 | 
			
		||||
                                        .WithUseServiceDiscovery(false)
 | 
			
		||||
                                        .Build())
 | 
			
		||||
@@ -332,7 +332,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
                    {
 | 
			
		||||
                        UpstreamPathTemplate = "/api/products/{productId}",
 | 
			
		||||
                        DownstreamPathTemplate = "/products/{productId}",
 | 
			
		||||
                        UpstreamHttpMethod = "Get",
 | 
			
		||||
                        UpstreamHttpMethod = new List<string> { "Get" },
 | 
			
		||||
                        ReRouteIsCaseSensitive = false
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
@@ -346,7 +346,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
                    new ReRouteBuilder()
 | 
			
		||||
                        .WithDownstreamPathTemplate("/products/{productId}")
 | 
			
		||||
                        .WithUpstreamPathTemplate("/api/products/{productId}")
 | 
			
		||||
                        .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                        .WithUpstreamTemplatePattern("(?i)/api/products/.*/$")
 | 
			
		||||
                        .Build()
 | 
			
		||||
                }))
 | 
			
		||||
@@ -367,7 +367,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
                    {
 | 
			
		||||
                        UpstreamPathTemplate = "/api/products/{productId}",
 | 
			
		||||
                        DownstreamPathTemplate = "/products/{productId}",
 | 
			
		||||
                        UpstreamHttpMethod = "Get",
 | 
			
		||||
                        UpstreamHttpMethod = new List<string> { "Get" },
 | 
			
		||||
                        ReRouteIsCaseSensitive = true
 | 
			
		||||
                    }
 | 
			
		||||
                },
 | 
			
		||||
@@ -385,7 +385,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
                    new ReRouteBuilder()
 | 
			
		||||
                        .WithDownstreamPathTemplate("/products/{productId}")
 | 
			
		||||
                        .WithUpstreamPathTemplate("/api/products/{productId}")
 | 
			
		||||
                        .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                        .WithRequestIdKey("blahhhh")
 | 
			
		||||
                        .Build()
 | 
			
		||||
                }))
 | 
			
		||||
@@ -414,7 +414,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
                new ReRouteBuilder()
 | 
			
		||||
                    .WithDownstreamPathTemplate("/products/{productId}")
 | 
			
		||||
                    .WithUpstreamPathTemplate("/api/products/{productId}")
 | 
			
		||||
                    .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                    .WithAuthenticationOptions(authenticationOptions)
 | 
			
		||||
                    .WithClaimsToHeaders(new List<ClaimToThing>
 | 
			
		||||
                    {
 | 
			
		||||
@@ -431,7 +431,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
                    {
 | 
			
		||||
                        UpstreamPathTemplate = "/api/products/{productId}",
 | 
			
		||||
                        DownstreamPathTemplate = "/products/{productId}",
 | 
			
		||||
                        UpstreamHttpMethod = "Get",
 | 
			
		||||
                        UpstreamHttpMethod = new List<string> { "Get" },
 | 
			
		||||
                        ReRouteIsCaseSensitive = true,
 | 
			
		||||
                        AuthenticationOptions = new FileAuthenticationOptions
 | 
			
		||||
                            {
 | 
			
		||||
@@ -482,7 +482,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
                new ReRouteBuilder()
 | 
			
		||||
                    .WithDownstreamPathTemplate("/products/{productId}")
 | 
			
		||||
                    .WithUpstreamPathTemplate("/api/products/{productId}")
 | 
			
		||||
                    .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                    .WithAuthenticationOptions(authenticationOptions)
 | 
			
		||||
                    .Build()
 | 
			
		||||
            };
 | 
			
		||||
@@ -495,7 +495,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
                    {
 | 
			
		||||
                        UpstreamPathTemplate = "/api/products/{productId}",
 | 
			
		||||
                        DownstreamPathTemplate = "/products/{productId}",
 | 
			
		||||
                        UpstreamHttpMethod = "Get",
 | 
			
		||||
                        UpstreamHttpMethod = new List<string> { "Get" },
 | 
			
		||||
                        ReRouteIsCaseSensitive = true,
 | 
			
		||||
                        AuthenticationOptions = new FileAuthenticationOptions
 | 
			
		||||
                            {
 | 
			
		||||
 
 | 
			
		||||
@@ -87,7 +87,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
            {
 | 
			
		||||
                new ReRouteBuilder()
 | 
			
		||||
                .WithDownstreamPathTemplate(_downstreamTemplatePath)
 | 
			
		||||
                .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                .Build()
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -66,7 +66,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                    new List<UrlPathPlaceholderNameAndValue>(), 
 | 
			
		||||
                    new ReRouteBuilder()
 | 
			
		||||
                        .WithDownstreamPathTemplate("any old string")
 | 
			
		||||
                        .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                        .Build())))
 | 
			
		||||
                .When(x => x.WhenICallTheMiddleware())
 | 
			
		||||
                .Then(x => x.ThenTheScopedDataRepositoryIsCalledCorrectly())
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                    new ReRouteBuilder()
 | 
			
		||||
                        .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                        .WithUpstreamPathTemplate("someUpstreamPath")
 | 
			
		||||
                        .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                        .WithUpstreamTemplatePattern("someUpstreamPath")
 | 
			
		||||
                        .Build()
 | 
			
		||||
                }, string.Empty
 | 
			
		||||
@@ -58,7 +58,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                            new List<UrlPathPlaceholderNameAndValue>(),
 | 
			
		||||
                            new ReRouteBuilder()
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                .Build()
 | 
			
		||||
                )))
 | 
			
		||||
                .And(x => x.ThenTheUrlMatcherIsCalledCorrectly())
 | 
			
		||||
@@ -78,7 +78,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                    new ReRouteBuilder()
 | 
			
		||||
                        .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                        .WithUpstreamPathTemplate("someUpstreamPath")
 | 
			
		||||
                        .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                        .WithUpstreamTemplatePattern("someUpstreamPath")
 | 
			
		||||
                        .Build()
 | 
			
		||||
                }, string.Empty
 | 
			
		||||
@@ -90,7 +90,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                    x => x.ThenTheFollowingIsReturned(new DownstreamRoute(new List<UrlPathPlaceholderNameAndValue>(),
 | 
			
		||||
                        new ReRouteBuilder()
 | 
			
		||||
                            .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                            .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                            .Build()
 | 
			
		||||
                        )))
 | 
			
		||||
                .And(x => x.ThenTheUrlMatcherIsNotCalled())
 | 
			
		||||
@@ -110,13 +110,13 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                    new ReRouteBuilder()
 | 
			
		||||
                        .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                        .WithUpstreamPathTemplate("someUpstreamPath")
 | 
			
		||||
                        .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                        .WithUpstreamTemplatePattern("")
 | 
			
		||||
                        .Build(),
 | 
			
		||||
                    new ReRouteBuilder()
 | 
			
		||||
                        .WithDownstreamPathTemplate("someDownstreamPathForAPost")
 | 
			
		||||
                        .WithUpstreamPathTemplate("someUpstreamPath")
 | 
			
		||||
                        .WithUpstreamHttpMethod("Post")
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                        .WithUpstreamTemplatePattern("")
 | 
			
		||||
                        .Build()
 | 
			
		||||
                }, string.Empty
 | 
			
		||||
@@ -128,7 +128,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                    x => x.ThenTheFollowingIsReturned(new DownstreamRoute(new List<UrlPathPlaceholderNameAndValue>(),
 | 
			
		||||
                        new ReRouteBuilder()
 | 
			
		||||
                            .WithDownstreamPathTemplate("someDownstreamPathForAPost")
 | 
			
		||||
                            .WithUpstreamHttpMethod("Post")
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                            .Build()
 | 
			
		||||
                        )))
 | 
			
		||||
                .BDDfy();
 | 
			
		||||
@@ -143,7 +143,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                        new ReRouteBuilder()
 | 
			
		||||
                        .WithDownstreamPathTemplate("somPath")
 | 
			
		||||
                        .WithUpstreamPathTemplate("somePath")
 | 
			
		||||
                        .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                        .WithUpstreamTemplatePattern("somePath")
 | 
			
		||||
                        .Build(),   
 | 
			
		||||
                     }, string.Empty
 | 
			
		||||
@@ -170,7 +170,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                    new ReRouteBuilder()
 | 
			
		||||
                        .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                        .WithUpstreamPathTemplate("someUpstreamPath")
 | 
			
		||||
                        .WithUpstreamHttpMethod("Get, Post")
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Get", "Post" })
 | 
			
		||||
                        .WithUpstreamTemplatePattern("")
 | 
			
		||||
                        .Build()
 | 
			
		||||
                }, string.Empty
 | 
			
		||||
@@ -182,7 +182,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                    x => x.ThenTheFollowingIsReturned(new DownstreamRoute(new List<UrlPathPlaceholderNameAndValue>(),
 | 
			
		||||
                        new ReRouteBuilder()
 | 
			
		||||
                            .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                            .WithUpstreamHttpMethod("Post")
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                            .Build()
 | 
			
		||||
                        )))
 | 
			
		||||
                .BDDfy();
 | 
			
		||||
@@ -201,7 +201,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                    new ReRouteBuilder()
 | 
			
		||||
                        .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                        .WithUpstreamPathTemplate("someUpstreamPath")
 | 
			
		||||
                        .WithUpstreamHttpMethod("")
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string>())
 | 
			
		||||
                        .WithUpstreamTemplatePattern("")
 | 
			
		||||
                        .Build()
 | 
			
		||||
                }, string.Empty
 | 
			
		||||
@@ -213,7 +213,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                    x => x.ThenTheFollowingIsReturned(new DownstreamRoute(new List<UrlPathPlaceholderNameAndValue>(),
 | 
			
		||||
                        new ReRouteBuilder()
 | 
			
		||||
                            .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                            .WithUpstreamHttpMethod("Post")
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Post" })
 | 
			
		||||
                            .Build()
 | 
			
		||||
                        )))
 | 
			
		||||
                .BDDfy();
 | 
			
		||||
@@ -232,7 +232,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                    new ReRouteBuilder()
 | 
			
		||||
                        .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                        .WithUpstreamPathTemplate("someUpstreamPath")
 | 
			
		||||
                        .WithUpstreamHttpMethod("Get, Patch, Delete")
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Get", "Patch", "Delete" })
 | 
			
		||||
                        .WithUpstreamTemplatePattern("")
 | 
			
		||||
                        .Build()
 | 
			
		||||
                }, string.Empty
 | 
			
		||||
 
 | 
			
		||||
@@ -78,7 +78,7 @@ namespace Ocelot.UnitTests.DownstreamUrlCreator
 | 
			
		||||
                    new List<UrlPathPlaceholderNameAndValue>(), 
 | 
			
		||||
                    new ReRouteBuilder()
 | 
			
		||||
                        .WithDownstreamPathTemplate("any old string")
 | 
			
		||||
                        .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                        .WithDownstreamScheme("https")
 | 
			
		||||
                        .Build())))
 | 
			
		||||
                .And(x => x.GivenTheDownstreamRequestUriIs("http://my.url/abc?q=123"))
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,7 @@ namespace Ocelot.UnitTests.DownstreamUrlCreator.UrlTemplateReplacer
 | 
			
		||||
                new DownstreamRoute(
 | 
			
		||||
                    new List<UrlPathPlaceholderNameAndValue>(), 
 | 
			
		||||
                    new ReRouteBuilder()
 | 
			
		||||
                        .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                        .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                        .Build())))
 | 
			
		||||
                .When(x => x.WhenIReplaceTheTemplateVariables())
 | 
			
		||||
                .Then(x => x.ThenTheDownstreamUrlPathIsReturned(""))
 | 
			
		||||
@@ -44,7 +44,7 @@ namespace Ocelot.UnitTests.DownstreamUrlCreator.UrlTemplateReplacer
 | 
			
		||||
                new List<UrlPathPlaceholderNameAndValue>(), 
 | 
			
		||||
                new ReRouteBuilder()
 | 
			
		||||
                    .WithDownstreamPathTemplate("/")
 | 
			
		||||
                    .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                    .Build())))
 | 
			
		||||
                .When(x => x.WhenIReplaceTheTemplateVariables())
 | 
			
		||||
                .Then(x => x.ThenTheDownstreamUrlPathIsReturned("/"))
 | 
			
		||||
@@ -57,7 +57,7 @@ namespace Ocelot.UnitTests.DownstreamUrlCreator.UrlTemplateReplacer
 | 
			
		||||
            this.Given(x => x.GivenThereIsAUrlMatch(new DownstreamRoute(new List<UrlPathPlaceholderNameAndValue>(), 
 | 
			
		||||
                new ReRouteBuilder()
 | 
			
		||||
                    .WithDownstreamPathTemplate("api")
 | 
			
		||||
                    .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                    .Build())))
 | 
			
		||||
                .When(x => x.WhenIReplaceTheTemplateVariables())
 | 
			
		||||
                .Then(x => x.ThenTheDownstreamUrlPathIsReturned("api"))
 | 
			
		||||
@@ -70,7 +70,7 @@ namespace Ocelot.UnitTests.DownstreamUrlCreator.UrlTemplateReplacer
 | 
			
		||||
            this.Given(x => x.GivenThereIsAUrlMatch(new DownstreamRoute(new List<UrlPathPlaceholderNameAndValue>(), 
 | 
			
		||||
                new ReRouteBuilder()
 | 
			
		||||
                    .WithDownstreamPathTemplate("api/")
 | 
			
		||||
                    .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                    .Build())))
 | 
			
		||||
                .When(x => x.WhenIReplaceTheTemplateVariables())
 | 
			
		||||
                .Then(x => x.ThenTheDownstreamUrlPathIsReturned("api/"))
 | 
			
		||||
@@ -83,7 +83,7 @@ namespace Ocelot.UnitTests.DownstreamUrlCreator.UrlTemplateReplacer
 | 
			
		||||
            this.Given(x => x.GivenThereIsAUrlMatch(new DownstreamRoute(new List<UrlPathPlaceholderNameAndValue>(), 
 | 
			
		||||
                new ReRouteBuilder()
 | 
			
		||||
                    .WithDownstreamPathTemplate("api/product/products/")
 | 
			
		||||
                    .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                    .Build())))
 | 
			
		||||
                .When(x => x.WhenIReplaceTheTemplateVariables())
 | 
			
		||||
                .Then(x => x.ThenTheDownstreamUrlPathIsReturned("api/product/products/"))
 | 
			
		||||
@@ -101,7 +101,7 @@ namespace Ocelot.UnitTests.DownstreamUrlCreator.UrlTemplateReplacer
 | 
			
		||||
            this.Given(x => x.GivenThereIsAUrlMatch(new DownstreamRoute(templateVariables, 
 | 
			
		||||
                new ReRouteBuilder()
 | 
			
		||||
                    .WithDownstreamPathTemplate("productservice/products/{productId}/")
 | 
			
		||||
                    .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                    .Build())))
 | 
			
		||||
             .When(x => x.WhenIReplaceTheTemplateVariables())
 | 
			
		||||
             .Then(x => x.ThenTheDownstreamUrlPathIsReturned("productservice/products/1/"))
 | 
			
		||||
@@ -119,7 +119,7 @@ namespace Ocelot.UnitTests.DownstreamUrlCreator.UrlTemplateReplacer
 | 
			
		||||
            this.Given(x => x.GivenThereIsAUrlMatch(new DownstreamRoute(templateVariables, 
 | 
			
		||||
                new ReRouteBuilder()
 | 
			
		||||
                    .WithDownstreamPathTemplate("productservice/products/{productId}/variants")
 | 
			
		||||
                    .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                    .Build())))
 | 
			
		||||
             .When(x => x.WhenIReplaceTheTemplateVariables())
 | 
			
		||||
             .Then(x => x.ThenTheDownstreamUrlPathIsReturned("productservice/products/1/variants"))
 | 
			
		||||
@@ -138,7 +138,7 @@ namespace Ocelot.UnitTests.DownstreamUrlCreator.UrlTemplateReplacer
 | 
			
		||||
            this.Given(x => x.GivenThereIsAUrlMatch(new DownstreamRoute(templateVariables, 
 | 
			
		||||
                new ReRouteBuilder()
 | 
			
		||||
                    .WithDownstreamPathTemplate("productservice/products/{productId}/variants/{variantId}")
 | 
			
		||||
                    .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                    .Build())))
 | 
			
		||||
             .When(x => x.WhenIReplaceTheTemplateVariables())
 | 
			
		||||
             .Then(x => x.ThenTheDownstreamUrlPathIsReturned("productservice/products/1/variants/12"))
 | 
			
		||||
@@ -158,7 +158,7 @@ namespace Ocelot.UnitTests.DownstreamUrlCreator.UrlTemplateReplacer
 | 
			
		||||
            this.Given(x => x.GivenThereIsAUrlMatch(new DownstreamRoute(templateVariables, 
 | 
			
		||||
                new ReRouteBuilder()
 | 
			
		||||
                .WithDownstreamPathTemplate("productservice/category/{categoryId}/products/{productId}/variants/{variantId}")
 | 
			
		||||
                .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                .Build())))
 | 
			
		||||
             .When(x => x.WhenIReplaceTheTemplateVariables())
 | 
			
		||||
             .Then(x => x.ThenTheDownstreamUrlPathIsReturned("productservice/category/34/products/1/variants/12"))
 | 
			
		||||
 
 | 
			
		||||
@@ -76,7 +76,7 @@ namespace Ocelot.UnitTests.Headers
 | 
			
		||||
                    {
 | 
			
		||||
                        new ClaimToThing("UserId", "Subject", "", 0)
 | 
			
		||||
                    })
 | 
			
		||||
                    .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                    .Build());
 | 
			
		||||
 | 
			
		||||
            this.Given(x => x.GivenTheDownStreamRouteIs(downstreamRoute))
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,7 @@ using Ocelot.Configuration.Builder;
 | 
			
		||||
using Ocelot.LoadBalancer.LoadBalancers;
 | 
			
		||||
using Ocelot.ServiceDiscovery;
 | 
			
		||||
using Shouldly;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using TestStack.BDDfy;
 | 
			
		||||
using Xunit;
 | 
			
		||||
 | 
			
		||||
@@ -29,7 +30,7 @@ namespace Ocelot.UnitTests.LoadBalancer
 | 
			
		||||
        {
 | 
			
		||||
            var reRoute = new ReRouteBuilder()
 | 
			
		||||
                .WithServiceProviderConfiguraion(new ServiceProviderConfigurationBuilder().Build())
 | 
			
		||||
                .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                .Build();
 | 
			
		||||
 | 
			
		||||
            this.Given(x => x.GivenAReRoute(reRoute))
 | 
			
		||||
@@ -44,7 +45,7 @@ namespace Ocelot.UnitTests.LoadBalancer
 | 
			
		||||
        {
 | 
			
		||||
             var reRoute = new ReRouteBuilder()
 | 
			
		||||
                .WithLoadBalancer("RoundRobin")
 | 
			
		||||
                .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                .WithServiceProviderConfiguraion(new ServiceProviderConfigurationBuilder().Build())
 | 
			
		||||
                .Build();
 | 
			
		||||
 | 
			
		||||
@@ -60,7 +61,7 @@ namespace Ocelot.UnitTests.LoadBalancer
 | 
			
		||||
        {
 | 
			
		||||
             var reRoute = new ReRouteBuilder()
 | 
			
		||||
                .WithLoadBalancer("LeastConnection")
 | 
			
		||||
                .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                .WithServiceProviderConfiguraion(new ServiceProviderConfigurationBuilder().Build())
 | 
			
		||||
                .Build();
 | 
			
		||||
 | 
			
		||||
@@ -76,7 +77,7 @@ namespace Ocelot.UnitTests.LoadBalancer
 | 
			
		||||
        {
 | 
			
		||||
            var reRoute = new ReRouteBuilder()
 | 
			
		||||
                .WithLoadBalancer("RoundRobin")
 | 
			
		||||
                .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                .WithServiceProviderConfiguraion(new ServiceProviderConfigurationBuilder().Build())
 | 
			
		||||
                .Build();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -73,7 +73,7 @@ namespace Ocelot.UnitTests.LoadBalancer
 | 
			
		||||
        {
 | 
			
		||||
            var downstreamRoute = new DownstreamRoute(new List<Ocelot.DownstreamRouteFinder.UrlMatcher.UrlPathPlaceholderNameAndValue>(),
 | 
			
		||||
                new ReRouteBuilder()
 | 
			
		||||
                    .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                    .Build());
 | 
			
		||||
 | 
			
		||||
            this.Given(x => x.GivenTheDownStreamUrlIs("http://my.url/abc?q=123"))
 | 
			
		||||
@@ -90,7 +90,7 @@ namespace Ocelot.UnitTests.LoadBalancer
 | 
			
		||||
        {         
 | 
			
		||||
            var downstreamRoute = new DownstreamRoute(new List<Ocelot.DownstreamRouteFinder.UrlMatcher.UrlPathPlaceholderNameAndValue>(),
 | 
			
		||||
                new ReRouteBuilder()
 | 
			
		||||
                    .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                    .Build());
 | 
			
		||||
 | 
			
		||||
            this.Given(x => x.GivenTheDownStreamUrlIs("http://my.url/abc?q=123"))
 | 
			
		||||
@@ -106,7 +106,7 @@ namespace Ocelot.UnitTests.LoadBalancer
 | 
			
		||||
        {
 | 
			
		||||
            var downstreamRoute = new DownstreamRoute(new List<Ocelot.DownstreamRouteFinder.UrlMatcher.UrlPathPlaceholderNameAndValue>(),
 | 
			
		||||
                new ReRouteBuilder()
 | 
			
		||||
                    .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                    .Build());
 | 
			
		||||
 | 
			
		||||
            this.Given(x => x.GivenTheDownStreamUrlIs("http://my.url/abc?q=123"))
 | 
			
		||||
 
 | 
			
		||||
@@ -74,7 +74,7 @@ namespace Ocelot.UnitTests.QueryStrings
 | 
			
		||||
                    {
 | 
			
		||||
                        new ClaimToThing("UserId", "Subject", "", 0)
 | 
			
		||||
                    })
 | 
			
		||||
                    .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                    .Build());
 | 
			
		||||
 | 
			
		||||
            this.Given(x => x.GivenTheDownStreamRouteIs(downstreamRoute))
 | 
			
		||||
 
 | 
			
		||||
@@ -72,7 +72,7 @@ namespace Ocelot.UnitTests.RateLimit
 | 
			
		||||
            var downstreamRoute = new DownstreamRoute(new List<Ocelot.DownstreamRouteFinder.UrlMatcher.UrlPathPlaceholderNameAndValue>(),
 | 
			
		||||
                 new ReRouteBuilder().WithEnableRateLimiting(true).WithRateLimitOptions(
 | 
			
		||||
                     new Ocelot.Configuration.RateLimitOptions(true, "ClientId", new List<string>(), false, "", "", new Ocelot.Configuration.RateLimitRule("1s", 100, 3), 429))
 | 
			
		||||
                     .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                     .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                     .Build());
 | 
			
		||||
 | 
			
		||||
            this.Given(x => x.GivenTheDownStreamRouteIs(downstreamRoute))
 | 
			
		||||
@@ -89,7 +89,7 @@ namespace Ocelot.UnitTests.RateLimit
 | 
			
		||||
            var downstreamRoute = new DownstreamRoute(new List<Ocelot.DownstreamRouteFinder.UrlMatcher.UrlPathPlaceholderNameAndValue>(),
 | 
			
		||||
                 new ReRouteBuilder().WithEnableRateLimiting(true).WithRateLimitOptions(
 | 
			
		||||
                     new Ocelot.Configuration.RateLimitOptions(true, "ClientId", new List<string>() { "ocelotclient2" }, false, "", "", new  RateLimitRule( "1s", 100,3),429))
 | 
			
		||||
                     .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                     .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                     .Build());
 | 
			
		||||
 | 
			
		||||
            this.Given(x => x.GivenTheDownStreamRouteIs(downstreamRoute))
 | 
			
		||||
 
 | 
			
		||||
@@ -76,7 +76,7 @@ namespace Ocelot.UnitTests.Request
 | 
			
		||||
            var downstreamRoute = new DownstreamRoute(new List<UrlPathPlaceholderNameAndValue>(),
 | 
			
		||||
                new ReRouteBuilder()
 | 
			
		||||
                    .WithRequestIdKey("LSRequestId")
 | 
			
		||||
                    .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                    .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                    .Build());
 | 
			
		||||
 | 
			
		||||
            this.Given(x => x.GivenTheDownStreamUrlIs("any old string"))
 | 
			
		||||
 
 | 
			
		||||
@@ -78,7 +78,7 @@ namespace Ocelot.UnitTests.RequestId
 | 
			
		||||
                new ReRouteBuilder()
 | 
			
		||||
                .WithDownstreamPathTemplate("any old string")
 | 
			
		||||
                .WithRequestIdKey("LSRequestId")
 | 
			
		||||
                .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                .Build());
 | 
			
		||||
 | 
			
		||||
            var requestId = Guid.NewGuid().ToString();
 | 
			
		||||
@@ -97,7 +97,7 @@ namespace Ocelot.UnitTests.RequestId
 | 
			
		||||
                new ReRouteBuilder()
 | 
			
		||||
                .WithDownstreamPathTemplate("any old string")
 | 
			
		||||
                .WithRequestIdKey("LSRequestId")
 | 
			
		||||
                .WithUpstreamHttpMethod("Get")
 | 
			
		||||
                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                .Build());
 | 
			
		||||
 | 
			
		||||
            this.Given(x => x.GivenTheDownStreamRouteIs(downstreamRoute))
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,7 @@ using Ocelot.Configuration.Builder;
 | 
			
		||||
using Ocelot.Logging;
 | 
			
		||||
using Ocelot.Requester.QoS;
 | 
			
		||||
using Shouldly;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using TestStack.BDDfy;
 | 
			
		||||
using Xunit;
 | 
			
		||||
 | 
			
		||||
@@ -31,7 +32,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
        public void should_return_no_qos_provider()
 | 
			
		||||
        {
 | 
			
		||||
            var reRoute = new ReRouteBuilder()
 | 
			
		||||
                .WithUpstreamHttpMethod("get")
 | 
			
		||||
                .WithUpstreamHttpMethod(new List<string> { "get" })
 | 
			
		||||
                .WithIsQos(false)
 | 
			
		||||
                .Build();
 | 
			
		||||
 | 
			
		||||
@@ -51,7 +52,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
                .Build();
 | 
			
		||||
 | 
			
		||||
            var reRoute = new ReRouteBuilder()
 | 
			
		||||
               .WithUpstreamHttpMethod("get")
 | 
			
		||||
               .WithUpstreamHttpMethod(new List<string> { "get" })
 | 
			
		||||
               .WithIsQos(true)
 | 
			
		||||
               .WithQosOptions(qosOptions)
 | 
			
		||||
               .Build();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user