mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-22 14:02:49 +08:00
Remove multiple concurrent blank lines
SA1507
This commit is contained in:
parent
edbed051de
commit
167fbb3daf
@ -123,7 +123,6 @@ namespace Ocelot.Cache.Middleware
|
||||
|
||||
var contentHeaders = response?.Content?.Headers.ToDictionary(v => v.Key, v => v.Value);
|
||||
|
||||
|
||||
var cached = new CachedResponse(statusCode, headers, body, contentHeaders);
|
||||
return cached;
|
||||
}
|
||||
|
@ -216,7 +216,6 @@ namespace Ocelot.Configuration.Builder
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public DownstreamReRoute Build()
|
||||
{
|
||||
return new DownstreamReRoute(
|
||||
|
@ -35,7 +35,6 @@ namespace Ocelot.Configuration.Creator
|
||||
private readonly IHeaderFindAndReplaceCreator _headerFAndRCreator;
|
||||
private readonly IDownstreamAddressesCreator _downstreamAddressesCreator;
|
||||
|
||||
|
||||
public FileOcelotConfigurationCreator(
|
||||
IOptions<FileConfiguration> options,
|
||||
IConfigurationValidator configurationValidator,
|
||||
|
@ -67,7 +67,6 @@ namespace Ocelot.Configuration.Creator
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool IsPlaceHolder(string upstreamTemplate, int i)
|
||||
{
|
||||
return upstreamTemplate[i] == '{';
|
||||
|
@ -16,7 +16,6 @@ namespace Ocelot.Configuration
|
||||
TimeoutStrategy = timeoutStrategy;
|
||||
}
|
||||
|
||||
|
||||
public int ExceptionsAllowedBeforeBreaking { get; private set; }
|
||||
|
||||
public int DurationOfBreak { get; private set; }
|
||||
|
@ -266,7 +266,6 @@ namespace Ocelot.DependencyInjection
|
||||
var baseSchemeUrlAndPort = urlFinder.Find();
|
||||
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
|
||||
|
||||
|
||||
_services.AddAuthentication(IdentityServerAuthenticationDefaults.AuthenticationScheme)
|
||||
.AddIdentityServerAuthentication(o =>
|
||||
{
|
||||
|
@ -17,7 +17,6 @@ namespace Ocelot.DownstreamRouteFinder.Middleware
|
||||
private readonly IOcelotConfigurationProvider _configProvider;
|
||||
private readonly IMultiplexer _multiplexer;
|
||||
|
||||
|
||||
public DownstreamRouteFinderMiddleware(OcelotRequestDelegate next,
|
||||
IOcelotLoggerFactory loggerFactory,
|
||||
IDownstreamRouteFinder downstreamRouteFinder,
|
||||
|
@ -25,7 +25,6 @@ namespace Ocelot.DownstreamUrlCreator
|
||||
return new ErrorResponse<DownstreamUrl>(new List<Error> { new DownstreamHostNullOrEmptyError() });
|
||||
}
|
||||
|
||||
|
||||
var builder = new UriBuilder
|
||||
{
|
||||
Host = downstreamHostAndPort.DownstreamHost,
|
||||
|
@ -37,7 +37,6 @@
|
||||
return new OkResponse<string>(value);
|
||||
}
|
||||
|
||||
|
||||
public Response<List<string>> GetValuesByClaimType(IEnumerable<Claim> claims, string claimType)
|
||||
{
|
||||
List<string> values = new List<string>();
|
||||
@ -47,7 +46,6 @@
|
||||
return new OkResponse<List<string>>(values);
|
||||
}
|
||||
|
||||
|
||||
private Response<string> GetValue(IEnumerable<Claim> claims, string key)
|
||||
{
|
||||
var claim = claims.FirstOrDefault(c => c.Type == key);
|
||||
|
@ -17,7 +17,6 @@ namespace Ocelot.LoadBalancer.LoadBalancers
|
||||
_services = services;
|
||||
}
|
||||
|
||||
|
||||
public async Task<Response<ServiceHostAndPort>> Lease()
|
||||
{
|
||||
var services = await _services.Invoke();
|
||||
|
@ -23,7 +23,6 @@ namespace Ocelot.RateLimit
|
||||
return _core.ProcessRequest(requestIdentity, option);
|
||||
}
|
||||
|
||||
|
||||
public int RetryAfterFrom(DateTime timestamp, RateLimitRule rule)
|
||||
{
|
||||
return _core.RetryAfterFrom(timestamp, rule);
|
||||
|
@ -18,7 +18,6 @@ namespace Ocelot.RequestId.Middleware
|
||||
private readonly IOcelotLogger _logger;
|
||||
private readonly IRequestScopedDataRepository _requestScopedDataRepository;
|
||||
|
||||
|
||||
public ReRouteRequestIdMiddleware(OcelotRequestDelegate next,
|
||||
IOcelotLoggerFactory loggerFactory,
|
||||
IRequestScopedDataRepository requestScopedDataRepository)
|
||||
|
@ -229,7 +229,6 @@ namespace Ocelot.AcceptanceTests
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void should_be_thread_safe()
|
||||
{
|
||||
|
@ -104,7 +104,6 @@ namespace Ocelot.AcceptanceTests
|
||||
.And(x => _steps.ThenTheResponseBodyShouldBe("Hello from Tom"))
|
||||
.BDDfy();
|
||||
|
||||
|
||||
var commandOnAllStateMachines = WaitFor(5000).Until(() => _butterflyCalled == 4);
|
||||
|
||||
commandOnAllStateMachines.ShouldBeTrue();
|
||||
|
@ -20,13 +20,11 @@ namespace Ocelot.AcceptanceTests
|
||||
private readonly Steps _steps;
|
||||
private int _counterOne;
|
||||
|
||||
|
||||
public ClientRateLimitTests()
|
||||
{
|
||||
_steps = new Steps();
|
||||
}
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_builder?.Dispose();
|
||||
@ -92,7 +90,6 @@ namespace Ocelot.AcceptanceTests
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void should_call_middleware_withWhitelistClient()
|
||||
{
|
||||
@ -147,7 +144,6 @@ namespace Ocelot.AcceptanceTests
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
private void GivenThereIsAServiceRunningOn(string baseUrl, string basePath)
|
||||
{
|
||||
_builder = new WebHostBuilder()
|
||||
|
@ -175,7 +175,6 @@ namespace Ocelot.AcceptanceTests
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void should_load_configuration_out_of_consul_if_it_is_changed()
|
||||
{
|
||||
|
@ -287,7 +287,6 @@ namespace Ocelot.AcceptanceTests
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
[Fact(Skip = "This is just an example to show how you could hook into Ocelot pipeline with your own middleware. At the moment you must use Response.OnCompleted callback and cannot change the response :( I will see if this can be changed one day!")]
|
||||
public void should_fix_issue_237()
|
||||
{
|
||||
|
@ -186,7 +186,6 @@ namespace Ocelot.AcceptanceTests
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
private void GivenThereIsAServiceRunningOn(string baseUrl, string basePath, int statusCode, string headerKey)
|
||||
{
|
||||
_builder = new WebHostBuilder()
|
||||
|
@ -543,7 +543,6 @@ namespace Ocelot.AcceptanceTests
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void should_return_response_200_with_complex_url_that_starts_with_placeholder()
|
||||
{
|
||||
@ -578,7 +577,6 @@ namespace Ocelot.AcceptanceTests
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void should_not_add_trailing_slash_to_downstream_url()
|
||||
{
|
||||
@ -834,7 +832,6 @@ namespace Ocelot.AcceptanceTests
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void should_fix_145()
|
||||
{
|
||||
|
@ -58,7 +58,6 @@ namespace Ocelot.AcceptanceTests
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void should_return_response_200_with_simple_url_and_hosts_match_multiple_re_routes()
|
||||
{
|
||||
|
@ -484,7 +484,6 @@ namespace Ocelot.IntegrationTests
|
||||
app.UseOcelot().Wait();
|
||||
});
|
||||
|
||||
|
||||
_builderTwo = _webHostBuilderTwo.Build();
|
||||
|
||||
_builderTwo.Start();
|
||||
|
@ -93,7 +93,6 @@ namespace Ocelot.UnitTests.Claims
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
private void GivenClaimsToThings(List<ClaimToThing> configuration)
|
||||
{
|
||||
_claimsToThings = configuration;
|
||||
|
@ -68,7 +68,6 @@ namespace Ocelot.UnitTests.Claims
|
||||
_middleware.Invoke(_downstreamContext).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
|
||||
private void GivenTheDownStreamRouteIs(DownstreamRoute downstreamRoute)
|
||||
{
|
||||
_downstreamContext.TemplatePlaceholderNameAndValues = downstreamRoute.TemplatePlaceholderNameAndValues;
|
||||
|
@ -869,7 +869,6 @@ namespace Ocelot.UnitTests.Configuration
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData("")]
|
||||
@ -1008,7 +1007,6 @@ namespace Ocelot.UnitTests.Configuration
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
private void GivenAConfiguration(FileConfiguration fileConfiguration)
|
||||
{
|
||||
_fileConfiguration = fileConfiguration;
|
||||
|
@ -12,7 +12,6 @@ using Xunit;
|
||||
using Shouldly;
|
||||
using static Ocelot.UnitTests.Wait;
|
||||
|
||||
|
||||
namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
public class ConsulFileConfigurationPollerTests : IDisposable
|
||||
|
@ -502,7 +502,6 @@ namespace Ocelot.UnitTests.Configuration
|
||||
.WithUseServiceDiscovery(false)
|
||||
.Build();
|
||||
|
||||
|
||||
this.Given(x => x.GivenTheConfigIs(new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
@ -545,7 +544,6 @@ namespace Ocelot.UnitTests.Configuration
|
||||
.WithUpstreamTemplatePattern(new UpstreamPathTemplate("(?i)/api/products/.*/$", 1))
|
||||
.Build();
|
||||
|
||||
|
||||
this.Given(x => x.GivenTheConfigIs(new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
@ -915,7 +913,6 @@ namespace Ocelot.UnitTests.Configuration
|
||||
.Setup(x => x.Create(It.IsAny<FileGlobalConfiguration>())).Returns(serviceProviderConfiguration);
|
||||
}
|
||||
|
||||
|
||||
private void GivenTheFollowingRegionIsReturned(string region)
|
||||
{
|
||||
_regionCreator
|
||||
|
@ -38,8 +38,6 @@ namespace Ocelot.UnitTests.Configuration
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void GivenTheConfigurationIs(FileConfiguration fileConfiguration)
|
||||
{
|
||||
_fileConfiguration = fileConfiguration;
|
||||
|
@ -48,7 +48,6 @@ namespace Ocelot.UnitTests.Configuration
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void should_return_error_if_unable_to_set_file_configuration()
|
||||
{
|
||||
|
@ -84,7 +84,6 @@ namespace Ocelot.UnitTests.Configuration
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void should_use_base_url_partial_placeholder()
|
||||
{
|
||||
|
@ -35,7 +35,6 @@ namespace Ocelot.UnitTests.Configuration
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void should_match_forward_slash_or_no_forward_slash_if_template_end_with_forward_slash()
|
||||
{
|
||||
|
@ -111,7 +111,6 @@ namespace Ocelot.UnitTests.Controllers
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
private void ThenTheNodeIsCalledCorrectly()
|
||||
{
|
||||
_node.Verify(x => x.Accept(It.IsAny<UpdateFileConfiguration>()), Times.Once);
|
||||
|
@ -70,7 +70,6 @@ namespace Ocelot.UnitTests.DependencyInjection
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void should_set_up_cache_manager()
|
||||
{
|
||||
@ -151,7 +150,6 @@ namespace Ocelot.UnitTests.DependencyInjection
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void should_set_up_without_passing_in_config()
|
||||
{
|
||||
|
@ -35,7 +35,6 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
|
||||
_downstreamRouteFinder = new Ocelot.DownstreamRouteFinder.Finder.DownstreamRouteFinder(_mockMatcher.Object, _finder.Object);
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void should_return_highest_priority_when_first()
|
||||
{
|
||||
@ -182,7 +181,6 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void should_not_append_slash_to_upstream_url_path()
|
||||
{
|
||||
@ -598,7 +596,6 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void should_return_route_when_host_matches_but_null_host_on_same_path_first()
|
||||
{
|
||||
|
@ -30,7 +30,6 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder.UrlMatcher
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void can_match_down_stream_url_with_nothing_then_placeholder_no_value_is_blank()
|
||||
{
|
||||
|
@ -29,7 +29,6 @@ namespace Ocelot.UnitTests.Errors
|
||||
private DownstreamContext _downstreamContext;
|
||||
private OcelotRequestDelegate _next;
|
||||
|
||||
|
||||
public ExceptionHandlerMiddlewareTests()
|
||||
{
|
||||
_provider = new Mock<IOcelotConfigurationProvider>();
|
||||
@ -174,7 +173,6 @@ namespace Ocelot.UnitTests.Errors
|
||||
.Setup(x => x.Get()).ReturnsAsync(response);
|
||||
}
|
||||
|
||||
|
||||
private void GivenAnExceptionWillNotBeThrownDownstream()
|
||||
{
|
||||
_shouldThrowAnException = false;
|
||||
|
@ -98,7 +98,6 @@ namespace Ocelot.UnitTests.Headers
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void should_replace_downstream_base_url_with_ocelot_base_url_and_path()
|
||||
{
|
||||
|
@ -35,7 +35,6 @@ namespace Ocelot.UnitTests.Infrastructure
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void should_return_ok_if_null_allowed_scopes()
|
||||
{
|
||||
|
@ -116,7 +116,6 @@ namespace Ocelot.UnitTests.LoadBalancer
|
||||
_factory.Verify(x => x.Get(_reRoute, _serviceProviderConfig), Times.Once);
|
||||
}
|
||||
|
||||
|
||||
private void GivenThereIsALoadBalancer(DownstreamReRoute reRoute, ILoadBalancer loadBalancer)
|
||||
{
|
||||
_reRoute = reRoute;
|
||||
|
@ -42,7 +42,6 @@ namespace Ocelot.UnitTests.Middleware
|
||||
.WithDownstreamReRoutes(downstreamReRoutes)
|
||||
.Build();
|
||||
|
||||
|
||||
var billDownstreamContext = new DownstreamContext(new DefaultHttpContext())
|
||||
{
|
||||
DownstreamResponse =
|
||||
|
@ -19,7 +19,6 @@ namespace Ocelot.UnitTests.RateLimit
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using System.IO;
|
||||
|
||||
|
||||
public class ClientRateLimitMiddlewareTests
|
||||
{
|
||||
private int _responseStatusCode;
|
||||
|
@ -165,7 +165,6 @@ namespace Ocelot.UnitTests.RequestId
|
||||
_repo.Verify(x => x.Update<string>("RequestId", _value), Times.Once);
|
||||
}
|
||||
|
||||
|
||||
private void GivenTheDownStreamRouteIs(DownstreamRoute downstreamRoute)
|
||||
{
|
||||
_downstreamContext.TemplatePlaceholderNameAndValues = downstreamRoute.TemplatePlaceholderNameAndValues;
|
||||
|
@ -41,7 +41,6 @@ namespace Ocelot.UnitTests.Requester
|
||||
.Returns(qosProvider);
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void should_all_from_all_routes_provider_and_qos()
|
||||
{
|
||||
|
@ -111,7 +111,6 @@ namespace Ocelot.UnitTests.Requester
|
||||
_getResult.Data.ShouldBe(_qoSProvider);
|
||||
}
|
||||
|
||||
|
||||
private void GivenThereIsAQoSProvider(DownstreamReRoute reRoute, IQoSProvider qoSProvider)
|
||||
{
|
||||
_reRoute = reRoute;
|
||||
|
@ -45,7 +45,6 @@ namespace Ocelot.UnitTests.Responder
|
||||
ShouldMapErrorToStatusCode(OcelotErrorCode.RequestTimedOutError, HttpStatusCode.ServiceUnavailable);
|
||||
}
|
||||
|
||||
|
||||
[Theory]
|
||||
[InlineData(OcelotErrorCode.CannotAddDataError)]
|
||||
[InlineData(OcelotErrorCode.CannotFindDataError)]
|
||||
|
@ -27,7 +27,6 @@ namespace Ocelot.UnitTests.Responder
|
||||
private readonly DownstreamContext _downstreamContext;
|
||||
private OcelotRequestDelegate _next;
|
||||
|
||||
|
||||
public ResponderMiddlewareTests()
|
||||
{
|
||||
_responder = new Mock<IHttpResponder>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user