#500 validate that there is an address in consul service, also made this clear in docs (#520)

This commit is contained in:
Tom Pallister
2018-07-31 21:21:46 +01:00
committed by GitHub
parent b854ca63ce
commit 43ad065e4a
4 changed files with 62 additions and 15 deletions

View File

@ -1,12 +0,0 @@
using Ocelot.Errors;
namespace Ocelot.ServiceDiscovery.Errors
{
public class UnableToFindServiceDiscoveryProviderError : Error
{
public UnableToFindServiceDiscoveryProviderError(string message)
: base(message, OcelotErrorCode.UnableToFindServiceDiscoveryProviderError)
{
}
}
}

View File

@ -59,7 +59,7 @@ namespace Ocelot.ServiceDiscovery.Providers
private bool IsValid(ServiceEntry serviceEntry)
{
if (serviceEntry.Service.Address.Contains("http://") || serviceEntry.Service.Address.Contains("https://") || serviceEntry.Service.Port <= 0)
if (string.IsNullOrEmpty(serviceEntry.Service.Address) || serviceEntry.Service.Address.Contains("http://") || serviceEntry.Service.Address.Contains("https://") || serviceEntry.Service.Port <= 0)
{
return false;
}