mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 11:50:49 +08:00 
			
		
		
		
	@@ -289,6 +289,39 @@
 | 
			
		||||
                .BDDfy();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [Fact]
 | 
			
		||||
        public void issue_473_should_not_remove_additional_query_string()
 | 
			
		||||
        {
 | 
			
		||||
            var downstreamReRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithDownstreamPathTemplate("/Authorized/{action}?server={server}")
 | 
			
		||||
                .WithUpstreamHttpMethod(new List<string> { "Post", "Get" })
 | 
			
		||||
                .WithDownstreamScheme("http")
 | 
			
		||||
                .WithUpstreamPathTemplate("/uc/Authorized/{server}/{action}")
 | 
			
		||||
                .Build();
 | 
			
		||||
 | 
			
		||||
            var config = new ServiceProviderConfigurationBuilder()
 | 
			
		||||
                .Build();
 | 
			
		||||
 | 
			
		||||
            this.Given(x => x.GivenTheDownStreamRouteIs(
 | 
			
		||||
                    new DownstreamRoute(
 | 
			
		||||
                        new List<PlaceholderNameAndValue>
 | 
			
		||||
                        {
 | 
			
		||||
                            new PlaceholderNameAndValue("{action}", "1"),
 | 
			
		||||
                            new PlaceholderNameAndValue("{server}", "2")
 | 
			
		||||
                        },
 | 
			
		||||
                        new ReRouteBuilder()
 | 
			
		||||
                            .WithDownstreamReRoute(downstreamReRoute)
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Post", "Get" })
 | 
			
		||||
                            .Build())))
 | 
			
		||||
                .And(x => x.GivenTheDownstreamRequestUriIs("http://localhost:5000/uc/Authorized/2/1/refresh?refreshToken=2288356cfb1338fdc5ff4ca558ec785118dfe1ff2864340937da8226863ff66d"))
 | 
			
		||||
                .And(x => GivenTheServiceProviderConfigIs(config))
 | 
			
		||||
                .And(x => x.GivenTheUrlReplacerWillReturn("/Authorized/1?server=2"))
 | 
			
		||||
                .When(x => x.WhenICallTheMiddleware())
 | 
			
		||||
                .Then(x => x.ThenTheDownstreamRequestUriIs("http://localhost:5000/Authorized/1?refreshToken=2288356cfb1338fdc5ff4ca558ec785118dfe1ff2864340937da8226863ff66d&server=2"))
 | 
			
		||||
                .And(x => ThenTheQueryStringIs("?refreshToken=2288356cfb1338fdc5ff4ca558ec785118dfe1ff2864340937da8226863ff66d&server=2"))
 | 
			
		||||
                .BDDfy();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void GivenTheServiceProviderConfigIs(ServiceProviderConfiguration config)
 | 
			
		||||
        {
 | 
			
		||||
            var configuration = new InternalConfiguration(null, null, config, null, null, null, null, null);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user