#555 added some tests for this issue but struggling to replicate (#570)

* #555 added some tests for this issue but struggling to replicate

* #555 removed cmd=instance from service fabric code as someone who knows service fabric says its not needed
I

* #555 renamed test
This commit is contained in:
Tom Pallister
2018-08-25 12:33:49 +01:00
committed by GitHub
parent b0bdeb9402
commit 369fc5b7a4
4 changed files with 63 additions and 17 deletions

View File

@ -117,24 +117,12 @@ namespace Ocelot.DownstreamUrlCreator.Middleware
{
var query = context.DownstreamRequest.Query;
var serviceFabricPath = $"/{context.DownstreamReRoute.ServiceName + dsPath.Data.Value}";
if (RequestForStatefullService(query))
{
return (serviceFabricPath, query);
}
var split = string.IsNullOrEmpty(query) ? "?" : "&";
return (serviceFabricPath, $"{query}{split}cmd=instance");
return (serviceFabricPath, query);
}
private static bool ServiceFabricRequest(DownstreamContext context)
{
return context.Configuration.ServiceProviderConfiguration.Type == "ServiceFabric" && context.DownstreamReRoute.UseServiceDiscovery;
}
private static bool RequestForStatefullService(string query)
{
return query.Contains("PartitionKind") && query.Contains("PartitionKey");
}
}
}