mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-22 14:02:49 +08:00
Reducing Warnings from Ocelot (#743)
This commit is contained in:
parent
6495891a07
commit
02e5cea7b1
@ -1,9 +1,8 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Ocelot.Middleware.Pipeline;
|
||||
using Ocelot.Middleware.Pipeline;
|
||||
|
||||
namespace Ocelot.Claims.Middleware
|
||||
{
|
||||
public static class ClaimsToClaimsMiddlewareExtensions
|
||||
public static class ClaimsBuilderMiddlewareExtensions
|
||||
{
|
||||
public static IOcelotPipelineBuilder UseClaimsToClaimsMiddleware(this IOcelotPipelineBuilder builder)
|
||||
{
|
||||
|
@ -2,7 +2,6 @@ using Ocelot.Configuration.File;
|
||||
|
||||
namespace Ocelot.Configuration.Creator
|
||||
{
|
||||
|
||||
public class LoadBalancerOptionsCreator : ILoadBalancerOptionsCreator
|
||||
{
|
||||
public LoadBalancerOptions Create(FileLoadBalancerOptions options)
|
||||
|
@ -26,7 +26,6 @@ namespace Ocelot.Infrastructure
|
||||
{ "{BaseUrl}", GetBaseUrl() },
|
||||
{ "{TraceId}", GetTraceId() },
|
||||
{ "{RemoteIpAddress}", GetRemoteIpAddress() }
|
||||
|
||||
};
|
||||
|
||||
_requestPlaceholders = new Dictionary<string, Func<DownstreamRequest, string>>
|
||||
@ -91,7 +90,7 @@ namespace Ocelot.Infrastructure
|
||||
var remoteIdAddress = _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString();
|
||||
return new OkResponse<string>(remoteIdAddress);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch
|
||||
{
|
||||
return new ErrorResponse<string>(new CouldNotFindPlaceholderError("{RemoteIpAddress}"));
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Responses;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Responses;
|
||||
|
||||
namespace Ocelot.LoadBalancer.LoadBalancers
|
||||
{
|
||||
@ -35,6 +35,7 @@ namespace Ocelot.LoadBalancer.LoadBalancers
|
||||
{
|
||||
return new ErrorResponse<ILoadBalancer>(result.Errors);
|
||||
}
|
||||
|
||||
loadBalancer = result.Data;
|
||||
AddLoadBalancer(reRoute.LoadBalancerKey, loadBalancer);
|
||||
}
|
||||
@ -43,10 +44,12 @@ namespace Ocelot.LoadBalancer.LoadBalancers
|
||||
}
|
||||
|
||||
result = await _factory.Get(reRoute, config);
|
||||
|
||||
if (result.IsError)
|
||||
{
|
||||
return new ErrorResponse<ILoadBalancer>(result.Errors);
|
||||
}
|
||||
|
||||
loadBalancer = result.Data;
|
||||
AddLoadBalancer(reRoute.LoadBalancerKey, loadBalancer);
|
||||
return new OkResponse<ILoadBalancer>(loadBalancer);
|
||||
|
@ -15,7 +15,6 @@ namespace Ocelot.Logging
|
||||
{
|
||||
_logger = factory.CreateLogger<OcelotDiagnosticListener>();
|
||||
_tracer = serviceProvider.GetService<ITracer>();
|
||||
|
||||
}
|
||||
|
||||
[DiagnosticName("Ocelot.MiddlewareException")]
|
||||
|
@ -76,6 +76,7 @@
|
||||
// now create the config
|
||||
var internalConfigCreator = builder.ApplicationServices.GetService<IInternalConfigurationCreator>();
|
||||
var internalConfig = await internalConfigCreator.Create(fileConfig.CurrentValue);
|
||||
|
||||
//Configuration error, throw error message
|
||||
if (internalConfig.IsError)
|
||||
{
|
||||
|
@ -40,6 +40,7 @@
|
||||
/// This allows the user to implement there own query string manipulation logic
|
||||
/// </summary>
|
||||
public Func<DownstreamContext, Func<Task>, Task> PreQueryStringBuilderMiddleware { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is an extension that will branch to different pipes
|
||||
/// </summary>
|
||||
|
@ -2,14 +2,13 @@
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
// Removed code and changed RequestDelete to OcelotRequestDelete, HttpContext to DownstreamContext, removed some exception handling messages
|
||||
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Ocelot.Middleware.Pipeline
|
||||
{
|
||||
@ -167,10 +166,12 @@ namespace Ocelot.Middleware.Pipeline
|
||||
{
|
||||
throw new ArgumentNullException(nameof(app));
|
||||
}
|
||||
|
||||
if (pipelineBuilderFunc == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(pipelineBuilderFunc));
|
||||
}
|
||||
|
||||
var branchBuilder = app.New();
|
||||
var predicate = pipelineBuilderFunc.Invoke(branchBuilder);
|
||||
var branch = branchBuilder.Build();
|
||||
|
@ -26,7 +26,6 @@
|
||||
HttpRequestMessage request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
return _tracer.SendAsync(request, cancellationToken, x => _repo.Add("TraceId", x), (r, c) => base.SendAsync(r, c));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user