#593 instanciate upstream path template when dynamic routing for logging (#594)

This commit is contained in:
Tom Pallister
2018-09-03 21:31:57 +01:00
committed by GitHub
parent 6198404697
commit ef6db657b7
13 changed files with 116 additions and 109 deletions

View File

@ -78,7 +78,7 @@ namespace Ocelot.Configuration.Builder
return this;
}
public DownstreamReRouteBuilder WithUpstreamTemplatePattern(UpstreamPathTemplate input)
public DownstreamReRouteBuilder WithUpstreamPathTemplate(UpstreamPathTemplate input)
{
_upstreamTemplatePattern = input;
return this;

View File

@ -36,7 +36,7 @@
return this;
}
public ReRouteBuilder WithUpstreamTemplatePattern(UpstreamPathTemplate input)
public ReRouteBuilder WithUpstreamPathTemplate(UpstreamPathTemplate input)
{
_upstreamTemplatePattern = input;
return this;

View File

@ -167,7 +167,7 @@ namespace Ocelot.Configuration.Creator
var reRoute = new ReRouteBuilder()
.WithUpstreamHttpMethod(aggregateReRoute.UpstreamHttpMethod)
.WithUpstreamTemplatePattern(upstreamTemplatePattern)
.WithUpstreamPathTemplate(upstreamTemplatePattern)
.WithDownstreamReRoutes(applicableReRoutes)
.WithUpstreamHost(aggregateReRoute.UpstreamHost)
.WithAggregator(aggregateReRoute.Aggregator)
@ -182,7 +182,7 @@ namespace Ocelot.Configuration.Creator
var reRoute = new ReRouteBuilder()
.WithUpstreamHttpMethod(fileReRoute.UpstreamHttpMethod)
.WithUpstreamTemplatePattern(upstreamTemplatePattern)
.WithUpstreamPathTemplate(upstreamTemplatePattern)
.WithDownstreamReRoute(downstreamReRoutes)
.WithUpstreamHost(fileReRoute.UpstreamHost)
.Build();
@ -228,7 +228,7 @@ namespace Ocelot.Configuration.Creator
.WithKey(fileReRoute.Key)
.WithDownstreamPathTemplate(fileReRoute.DownstreamPathTemplate)
.WithUpstreamHttpMethod(fileReRoute.UpstreamHttpMethod)
.WithUpstreamTemplatePattern(upstreamTemplatePattern)
.WithUpstreamPathTemplate(upstreamTemplatePattern)
.WithIsAuthenticated(fileReRouteOptions.IsAuthenticated)
.WithAuthenticationOptions(authOptionsForRoute)
.WithClaimsToHeaders(claimsToHeaders)

View File

@ -44,6 +44,8 @@
var qosOptions = _qoSOptionsCreator.Create(configuration.QoSOptions, downstreamPathForKeys, new []{ upstreamHttpMethod });
var upstreamPathTemplate = new UpstreamPathTemplateBuilder().WithOriginalValue(upstreamUrlPath).Build();
var downstreamReRouteBuilder = new DownstreamReRouteBuilder()
.WithServiceName(serviceName)
.WithLoadBalancerKey(loadBalancerKey)
@ -52,7 +54,8 @@
.WithHttpHandlerOptions(configuration.HttpHandlerOptions)
.WithQosOptions(qosOptions)
.WithDownstreamScheme(configuration.DownstreamScheme)
.WithLoadBalancerOptions(configuration.LoadBalancerOptions);
.WithLoadBalancerOptions(configuration.LoadBalancerOptions)
.WithUpstreamPathTemplate(upstreamPathTemplate);
var rateLimitOptions = configuration.ReRoutes != null
? configuration.ReRoutes
@ -72,6 +75,7 @@
var reRoute = new ReRouteBuilder()
.WithDownstreamReRoute(downstreamReRoute)
.WithUpstreamHttpMethod(new List<string>(){ upstreamHttpMethod })
.WithUpstreamPathTemplate(upstreamPathTemplate)
.Build();
downstreamRoute = new OkResponse<DownstreamRoute>(new DownstreamRoute(new List<PlaceholderNameAndValue>(), reRoute));