mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 09:15:27 +08:00 
			
		
		
		
	Feature/#574 look at httpclient cache key (#589)
* #574 consolidate some code, man the config stuff is a mess! * #574 just use the downstream re route and the key for caching http clients * #574 added benchmark, i was suprised to learn using a complex type was faster than a string in benchmark .net dictionary tests, hey ho probably dont have enough data in the type...
This commit is contained in:
		@@ -296,7 +296,7 @@
 | 
			
		||||
                .WithDownstreamPathTemplate("/Authorized/{action}?server={server}")
 | 
			
		||||
                .WithUpstreamHttpMethod(new List<string> { "Post", "Get" })
 | 
			
		||||
                .WithDownstreamScheme("http")
 | 
			
		||||
                .WithUpstreamPathTemplate("/uc/Authorized/{server}/{action}")
 | 
			
		||||
                .WithUpstreamTemplatePattern(new UpstreamPathTemplateBuilder().WithOriginalValue("/uc/Authorized/{server}/{action}").Build())
 | 
			
		||||
                .Build();
 | 
			
		||||
 | 
			
		||||
            var config = new ServiceProviderConfigurationBuilder()
 | 
			
		||||
@@ -350,7 +350,7 @@
 | 
			
		||||
        {
 | 
			
		||||
            _downstreamPath = new OkResponse<DownstreamPath>(new DownstreamPath(path));
 | 
			
		||||
            _downstreamUrlTemplateVariableReplacer
 | 
			
		||||
                .Setup(x => x.Replace(It.IsAny<PathTemplate>(), It.IsAny<List<PlaceholderNameAndValue>>()))
 | 
			
		||||
                .Setup(x => x.Replace(It.IsAny<DownstreamPathTemplate>(), It.IsAny<List<PlaceholderNameAndValue>>()))
 | 
			
		||||
                .Returns(_downstreamPath);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -199,7 +199,7 @@ namespace Ocelot.UnitTests.DownstreamUrlCreator.UrlTemplateReplacer
 | 
			
		||||
 | 
			
		||||
        private void WhenIReplaceTheTemplateVariables()
 | 
			
		||||
        {
 | 
			
		||||
            _result = _downstreamPathReplacer.Replace(_downstreamRoute.ReRoute.DownstreamReRoute[0].DownstreamPathTemplate, _downstreamRoute.TemplatePlaceholderNameAndValues);
 | 
			
		||||
            _result = _downstreamPathReplacer.Replace(_downstreamRoute.ReRoute.DownstreamReRoute[0].DownstreamDownstreamPathTemplate, _downstreamRoute.TemplatePlaceholderNameAndValues);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void ThenTheDownstreamUrlPathIsReturned(string expected)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user