Skip to content

Commit bfdf626

Browse files
committed
uri path append
1 parent b60706c commit bfdf626

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/NetCoreStack.Proxy/DefaultProxyEndpointManager.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ public ProxyUriDefinition CreateUriDefinition(ProxyDescriptor descriptor, string
2626
if (!string.IsNullOrEmpty(descriptor.Route))
2727
{
2828
if (targetMethodName.ToLower() == HttpMethod.Get.Method.ToLower())
29-
uriDefinition.UriBuilder.Path = $"{descriptor.Route}/";
29+
{
30+
var path = uriDefinition.UriBuilder.Path ?? string.Empty;
31+
path += $"{descriptor.Route}/";
32+
uriDefinition.UriBuilder.Path = path;
33+
}
3034
else
3135
{
3236
if (targetMethodName.StartsWith("/"))

src/NetCoreStack.Proxy/ProxyUriDefinition.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public ProxyUriDefinition(UriBuilder uriBuilder)
2323

2424
public void ResolveTemplate(RouteTemplate routeTemplate, string route, string template)
2525
{
26+
var path = UriBuilder.Path ?? string.Empty;
2627
if (routeTemplate != null)
2728
{
2829
if (routeTemplate.Parameters.Count > 0)
@@ -32,7 +33,8 @@ public void ResolveTemplate(RouteTemplate routeTemplate, string route, string te
3233
var key = route + "/" + template;
3334
if (TemplateCache.TryGetValue(key, out string tmpl))
3435
{
35-
UriBuilder.Path = $"{route}/{tmpl}";
36+
path += $"{route}/{tmpl}";
37+
UriBuilder.Path = path;
3638
return;
3739
}
3840

@@ -42,12 +44,15 @@ public void ResolveTemplate(RouteTemplate routeTemplate, string route, string te
4244

4345
tmpl = string.Join("/", segments);
4446
TemplateCache.Add(key, tmpl);
45-
UriBuilder.Path = $"{route}/{tmpl}";
47+
48+
path += $"{route}/{tmpl}";
49+
UriBuilder.Path = path;
4650
return;
4751
}
4852
}
4953

50-
UriBuilder.Path = $"{route}/{template}";
54+
path += $"{route}/{template}";
55+
UriBuilder.Path = path;
5156
}
5257
}
5358
}

0 commit comments

Comments
 (0)