diff --git a/README.md b/README.md index b59f84f3e..f6ff9b57c 100644 --- a/README.md +++ b/README.md @@ -55,9 +55,9 @@ A quick list of Ocelot's capabilities for more information see the [documentatio ## How to install -Ocelot is designed to work with ASP.NET Core only and it targets `netstandard2.0`. This means it can be used anywhere `.NET Standard 2.0` is supported, including `.NET Core 3.1` and `.NET Framework 4.8` and up. [This](https://docs.microsoft.com/en-us/dotnet/standard/net-standard) documentation may prove helpful when working out if Ocelot would be suitable for you. +Ocelot is designed to work with ASP.NET Core only and it targets `netcoreapp3.1`. -Install Ocelot and it's dependencies using NuGet. +Install Ocelot and it's dependencies using NuGet. `Install-Package Ocelot` diff --git a/docs/introduction/gettingstarted.rst b/docs/introduction/gettingstarted.rst index e2178c984..8bcb98a39 100644 --- a/docs/introduction/gettingstarted.rst +++ b/docs/introduction/gettingstarted.rst @@ -1,15 +1,14 @@ Getting Started =============== -Ocelot is designed to work with .NET Core only and is currently -built to netstandard2.0. `This `_ documentation may prove helpful when working out if Ocelot would be suitable for you. +Ocelot is designed to work with .NET Core only and is currently on netcoreapp3.1. .NET Core 3.1 ^^^^^^^^^^^^^ **Install NuGet package** -Install Ocelot and it's dependencies using nuget. You will need to create a netstandard2.0 project and bring the package into it. Then follow the Startup below and :doc:`../features/configuration` sections +Install Ocelot and it's dependencies using nuget. You will need to create a netcoreapp3.1 project and bring the package into it. Then follow the Startup below and :doc:`../features/configuration` sections to get up and running. ``Install-Package Ocelot`` diff --git a/samples/AdministrationApi/AdministrationApi.csproj b/samples/AdministrationApi/AdministrationApi.csproj index e634ba2ce..810fa13c8 100644 --- a/samples/AdministrationApi/AdministrationApi.csproj +++ b/samples/AdministrationApi/AdministrationApi.csproj @@ -6,8 +6,8 @@ - - + + \ No newline at end of file diff --git a/samples/OcelotBasic/OcelotBasic.csproj b/samples/OcelotBasic/OcelotBasic.csproj index 5e2902064..26b7a4412 100644 --- a/samples/OcelotBasic/OcelotBasic.csproj +++ b/samples/OcelotBasic/OcelotBasic.csproj @@ -5,7 +5,7 @@ - + diff --git a/samples/OcelotEureka/ApiGateway/ApiGateway.csproj b/samples/OcelotEureka/ApiGateway/ApiGateway.csproj index a257c9801..bc5318be1 100644 --- a/samples/OcelotEureka/ApiGateway/ApiGateway.csproj +++ b/samples/OcelotEureka/ApiGateway/ApiGateway.csproj @@ -15,9 +15,9 @@ - - - + + + diff --git a/samples/OcelotEureka/DownstreamService/Startup.cs b/samples/OcelotEureka/DownstreamService/Startup.cs index b3924be64..aa488ad84 100644 --- a/samples/OcelotEureka/DownstreamService/Startup.cs +++ b/samples/OcelotEureka/DownstreamService/Startup.cs @@ -11,6 +11,7 @@ namespace DownstreamService { + using Microsoft.Extensions.Hosting; using Steeltoe.Discovery.Client; public class Startup @@ -30,7 +31,7 @@ public void ConfigureServices(IServiceCollection services) } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env) + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { diff --git a/samples/OcelotGraphQL/OcelotGraphQL.csproj b/samples/OcelotGraphQL/OcelotGraphQL.csproj index 408d8543e..df8f3ec71 100644 --- a/samples/OcelotGraphQL/OcelotGraphQL.csproj +++ b/samples/OcelotGraphQL/OcelotGraphQL.csproj @@ -11,7 +11,7 @@ - - + + \ No newline at end of file diff --git a/samples/OcelotGraphQL/Program.cs b/samples/OcelotGraphQL/Program.cs index 83a48fda1..a18240572 100644 --- a/samples/OcelotGraphQL/Program.cs +++ b/samples/OcelotGraphQL/Program.cs @@ -28,7 +28,7 @@ public class Hero public class Query { - private List _heroes = new List + private readonly List _heroes = new List { new Hero { Id = 1, Name = "R2-D2" }, new Hero { Id = 2, Name = "Batman" }, @@ -58,7 +58,7 @@ protected async override Task SendAsync(HttpRequestMessage var query = await request.Content.ReadAsStringAsync(); //if not body try query string, dont hack like this in real world.. - if(query.Length == 0) + if (query.Length == 0) { var decoded = WebUtility.UrlDecode(request.RequestUri.Query); query = decoded.Replace("?query=", ""); @@ -82,7 +82,7 @@ protected async override Task SendAsync(HttpRequestMessage public class Program { - public static void Main(string[] args) + public static void Main() { var schema = Schema.For(@" type Hero { @@ -93,7 +93,8 @@ type Hero { type Query { hero(id: Int): Hero } - ", _ => { + ", _ => + { _.Types.Include(); }); @@ -109,10 +110,11 @@ type Query { .AddJsonFile("ocelot.json", false, false) .AddEnvironmentVariables(); }) - .ConfigureServices(s => { - s.AddSingleton(schema); - s.AddOcelot() - .AddSingletonDelegatingHandler(); + .ConfigureServices(s => + { + s.AddSingleton(schema); + s.AddOcelot() + .AddDelegatingHandler(); }) .ConfigureLogging((hostingContext, logging) => { @@ -125,7 +127,7 @@ type Query { app.UseOcelot().Wait(); }) .Build() - .Run(); - } + .Run(); } + } } diff --git a/samples/OcelotKube/ApiGateway/ApiGateway.csproj b/samples/OcelotKube/ApiGateway/ApiGateway.csproj index 05f462ab7..8cf74f8d1 100644 --- a/samples/OcelotKube/ApiGateway/ApiGateway.csproj +++ b/samples/OcelotKube/ApiGateway/ApiGateway.csproj @@ -7,11 +7,9 @@ - - - - - + + + diff --git a/samples/OcelotKube/DownstreamService/DownstreamService.csproj b/samples/OcelotKube/DownstreamService/DownstreamService.csproj index d430c524e..3947a3de9 100644 --- a/samples/OcelotKube/DownstreamService/DownstreamService.csproj +++ b/samples/OcelotKube/DownstreamService/DownstreamService.csproj @@ -7,9 +7,7 @@ - - - + diff --git a/samples/OcelotServiceFabric/src/OcelotApplicationService/OcelotApplicationService.csproj b/samples/OcelotServiceFabric/src/OcelotApplicationService/OcelotApplicationService.csproj index ea45d7375..236cb1790 100644 --- a/samples/OcelotServiceFabric/src/OcelotApplicationService/OcelotApplicationService.csproj +++ b/samples/OcelotServiceFabric/src/OcelotApplicationService/OcelotApplicationService.csproj @@ -1,21 +1,18 @@ - - - Stateless Service Application - - Exe - netcoreapp3.1 - OcelotApplicationService - OcelotApplicationService - $(PackageTargetFallback) - - - - - - - - - - - + + + Stateless Service Application + + Exe + netcoreapp3.1 + OcelotApplicationService + OcelotApplicationService + $(PackageTargetFallback) + + + + + + + + \ No newline at end of file diff --git a/src/Ocelot.Administration/Ocelot.Administration.csproj b/src/Ocelot.Administration/Ocelot.Administration.csproj index c1be05990..88375a183 100644 --- a/src/Ocelot.Administration/Ocelot.Administration.csproj +++ b/src/Ocelot.Administration/Ocelot.Administration.csproj @@ -27,11 +27,11 @@ - + all - + diff --git a/src/Ocelot.Cache.CacheManager/Ocelot.Cache.CacheManager.csproj b/src/Ocelot.Cache.CacheManager/Ocelot.Cache.CacheManager.csproj index 4c575fe54..dcc97dd6f 100644 --- a/src/Ocelot.Cache.CacheManager/Ocelot.Cache.CacheManager.csproj +++ b/src/Ocelot.Cache.CacheManager/Ocelot.Cache.CacheManager.csproj @@ -26,7 +26,7 @@ - + all diff --git a/src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj b/src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj index ece85c9b3..eaae221fe 100644 --- a/src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj +++ b/src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj @@ -28,7 +28,7 @@ - + all diff --git a/src/Ocelot.Provider.Eureka/Ocelot.Provider.Eureka.csproj b/src/Ocelot.Provider.Eureka/Ocelot.Provider.Eureka.csproj index 587071e03..e808bf931 100644 --- a/src/Ocelot.Provider.Eureka/Ocelot.Provider.Eureka.csproj +++ b/src/Ocelot.Provider.Eureka/Ocelot.Provider.Eureka.csproj @@ -27,8 +27,8 @@ - - + + all diff --git a/src/Ocelot.Provider.Kubernetes/Ocelot.Provider.Kubernetes.csproj b/src/Ocelot.Provider.Kubernetes/Ocelot.Provider.Kubernetes.csproj index 980cd909a..8f3428656 100644 --- a/src/Ocelot.Provider.Kubernetes/Ocelot.Provider.Kubernetes.csproj +++ b/src/Ocelot.Provider.Kubernetes/Ocelot.Provider.Kubernetes.csproj @@ -28,8 +28,8 @@ - - + + diff --git a/src/Ocelot.Provider.Polly/Ocelot.Provider.Polly.csproj b/src/Ocelot.Provider.Polly/Ocelot.Provider.Polly.csproj index 447db1da4..e082c6066 100644 --- a/src/Ocelot.Provider.Polly/Ocelot.Provider.Polly.csproj +++ b/src/Ocelot.Provider.Polly/Ocelot.Provider.Polly.csproj @@ -27,10 +27,10 @@ - + all - + diff --git a/src/Ocelot.Provider.Rafty/Ocelot.Provider.Rafty.csproj b/src/Ocelot.Provider.Rafty/Ocelot.Provider.Rafty.csproj index 8cb2ab420..058fb0cfd 100644 --- a/src/Ocelot.Provider.Rafty/Ocelot.Provider.Rafty.csproj +++ b/src/Ocelot.Provider.Rafty/Ocelot.Provider.Rafty.csproj @@ -28,9 +28,9 @@ - + - + all diff --git a/src/Ocelot/Configuration/Builder/RateLimitOptionsBuilder.cs b/src/Ocelot/Configuration/Builder/RateLimitOptionsBuilder.cs index eaaa4dab6..93ee9cb1e 100644 --- a/src/Ocelot/Configuration/Builder/RateLimitOptionsBuilder.cs +++ b/src/Ocelot/Configuration/Builder/RateLimitOptionsBuilder.cs @@ -7,7 +7,6 @@ public class RateLimitOptionsBuilder { private bool _enableRateLimiting; private string _clientIdHeader; - private List _clientWhitelist; private Func> _getClientWhitelist; private bool _disableRateLimitHeaders; private string _quotaExceededMessage; diff --git a/src/Ocelot/Errors/Middleware/ExceptionHandlerMiddleware.cs b/src/Ocelot/Errors/Middleware/ExceptionHandlerMiddleware.cs index 6d583e66b..0f6dce423 100644 --- a/src/Ocelot/Errors/Middleware/ExceptionHandlerMiddleware.cs +++ b/src/Ocelot/Errors/Middleware/ExceptionHandlerMiddleware.cs @@ -54,7 +54,7 @@ public async Task Invoke(DownstreamContext context) await _next.Invoke(context); } - catch (OperationCanceledException e) when (context.HttpContext.RequestAborted.IsCancellationRequested) + catch (OperationCanceledException) when (context.HttpContext.RequestAborted.IsCancellationRequested) { Logger.LogDebug("operation canceled"); if (!context.HttpContext.Response.HasStarted) diff --git a/src/Ocelot/Ocelot.csproj b/src/Ocelot/Ocelot.csproj index 7c290d0ac..bf8a4a6bc 100644 --- a/src/Ocelot/Ocelot.csproj +++ b/src/Ocelot/Ocelot.csproj @@ -9,7 +9,6 @@ Ocelot API Gateway;.NET core https://github.com/ThreeMammals/Ocelot - https://github.com/ThreeMammals/Ocelot http://threemammals.com/images/ocelot_logo.png win10-x64;osx.10.11-x64;osx.10.12-x64;win7-x64 false @@ -25,13 +24,13 @@ - - - + + + NU1701 - - + + all diff --git a/test/Ocelot.AcceptanceTests/ConfigurationInConsulTests.cs b/test/Ocelot.AcceptanceTests/ConfigurationInConsulTests.cs index 4d806b05d..ae6b6c426 100644 --- a/test/Ocelot.AcceptanceTests/ConfigurationInConsulTests.cs +++ b/test/Ocelot.AcceptanceTests/ConfigurationInConsulTests.cs @@ -2,6 +2,7 @@ namespace Ocelot.AcceptanceTests { using Configuration.File; using Consul; + using IdentityServer4.Extensions; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; @@ -169,9 +170,9 @@ private void GivenThereIsAServiceRunningOn(string url, string basePath, int stat { context.Response.StatusCode = statusCode; await context.Response.WriteAsync(responseBody); - }); }); - }) + }); + }) .Build(); _builder.Start(); diff --git a/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj b/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj index 356561bb6..5adb82a6d 100644 --- a/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj +++ b/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj @@ -38,36 +38,36 @@ - - - - + + + + all all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - + + + + + + + + - + - + diff --git a/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj b/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj index 0ebd49e7c..0cbe43071 100644 --- a/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj +++ b/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj @@ -18,8 +18,8 @@ - - + + all diff --git a/test/Ocelot.IntegrationTests/HeaderTests.cs b/test/Ocelot.IntegrationTests/HeaderTests.cs index a57644f81..6b6d8e362 100644 --- a/test/Ocelot.IntegrationTests/HeaderTests.cs +++ b/test/Ocelot.IntegrationTests/HeaderTests.cs @@ -161,7 +161,7 @@ private void GivenThereIsAConfiguration(FileConfiguration fileConfiguration) text = File.ReadAllText(configurationPath); } - public async Task WhenIGetUrlOnTheApiGateway(string url) + private async Task WhenIGetUrlOnTheApiGateway(string url) { var request = new HttpRequestMessage(HttpMethod.Get, url); _response = await _httpClient.SendAsync(request); diff --git a/test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj b/test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj index 96286ca43..59b45dc49 100644 --- a/test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj +++ b/test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj @@ -31,29 +31,29 @@ - - - + + + all all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - + + + + + + + - + - + diff --git a/test/Ocelot.ManualTest/Ocelot.ManualTest.csproj b/test/Ocelot.ManualTest/Ocelot.ManualTest.csproj index 2d31ecc36..40e36ebcc 100644 --- a/test/Ocelot.ManualTest/Ocelot.ManualTest.csproj +++ b/test/Ocelot.ManualTest/Ocelot.ManualTest.csproj @@ -28,14 +28,14 @@ - - - - - - - - + + + + + + + + all diff --git a/test/Ocelot.UnitTests/DependencyInjection/ConfigurationBuilderExtensionsTests.cs b/test/Ocelot.UnitTests/DependencyInjection/ConfigurationBuilderExtensionsTests.cs index 1d408ba41..1c1f11770 100644 --- a/test/Ocelot.UnitTests/DependencyInjection/ConfigurationBuilderExtensionsTests.cs +++ b/test/Ocelot.UnitTests/DependencyInjection/ConfigurationBuilderExtensionsTests.cs @@ -321,7 +321,7 @@ private void GivenTheBaseUrl(string baseUrl) private void WhenIGet(string key) { - _result = _configuration.GetValue("BaseUrl", ""); + _result = _configuration.GetValue(key, ""); } private void ThenTheResultIs(string expected) diff --git a/test/Ocelot.UnitTests/Eureka/OcelotPipelineExtensionsTests.cs b/test/Ocelot.UnitTests/Eureka/OcelotPipelineExtensionsTests.cs index 9ee61f216..340998aa2 100644 --- a/test/Ocelot.UnitTests/Eureka/OcelotPipelineExtensionsTests.cs +++ b/test/Ocelot.UnitTests/Eureka/OcelotPipelineExtensionsTests.cs @@ -5,7 +5,7 @@ using Ocelot.DependencyInjection; using Ocelot.Middleware; using Ocelot.Middleware.Pipeline; - using Pivotal.Discovery.Client; + using Steeltoe.Discovery.Client; using Shouldly; using Steeltoe.Common.Discovery; using Steeltoe.Discovery.Eureka; diff --git a/test/Ocelot.UnitTests/Kubernetes/KubeServiceDiscoveryProviderTests.cs b/test/Ocelot.UnitTests/Kubernetes/KubeServiceDiscoveryProviderTests.cs index 8534194d4..0f15ff560 100644 --- a/test/Ocelot.UnitTests/Kubernetes/KubeServiceDiscoveryProviderTests.cs +++ b/test/Ocelot.UnitTests/Kubernetes/KubeServiceDiscoveryProviderTests.cs @@ -22,7 +22,7 @@ public class KubeServiceDiscoveryProviderTests : IDisposable { private IWebHost _fakeKubeBuilder; private ServiceV1 _serviceEntries; - private Kube _provider; + private readonly Kube _provider; private readonly string _serviceName; private readonly string _namespaces; private readonly int _port; @@ -38,7 +38,7 @@ public KubeServiceDiscoveryProviderTests() { _serviceName = "test"; _namespaces = "dev"; - _port = 8001; + _port = 86; _kubeHost = "localhost"; _fakekubeServiceDiscoveryUrl = $"http://{_kubeHost}:{_port}"; _serviceEntries = new ServiceV1(); diff --git a/test/Ocelot.UnitTests/Kubernetes/OcelotBuilderExtensionsTests.cs b/test/Ocelot.UnitTests/Kubernetes/OcelotBuilderExtensionsTests.cs index f858c1beb..0ba386b10 100644 --- a/test/Ocelot.UnitTests/Kubernetes/OcelotBuilderExtensionsTests.cs +++ b/test/Ocelot.UnitTests/Kubernetes/OcelotBuilderExtensionsTests.cs @@ -16,7 +16,6 @@ namespace Ocelot.UnitTests.Kubernetes public class OcelotBuilderExtensionsTests { private readonly IServiceCollection _services; - private IServiceProvider _serviceProvider; private readonly IConfiguration _configRoot; private IOcelotBuilder _ocelotBuilder; private Exception _ex; diff --git a/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj b/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj index b999c7be6..b2a031d49 100644 --- a/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj +++ b/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj @@ -46,13 +46,13 @@ PreserveNewest - + - - - + + + all @@ -60,26 +60,26 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - + + + + + + + + - - + + - + @@ -89,7 +89,7 @@ - + all runtime; build; native; contentfiles; analyzers