public ClientRateLimitMiddleware(RequestDelegate next, IOcelotLoggerFactory loggerFactory, IRateLimitCounterHandler counterHandler) : base(loggerFactory.CreateLogger <ClientRateLimitMiddleware>()) { _next = next; _processor = new ClientRateLimitProcessor(counterHandler); }
public ClientRateLimitMiddleware(RequestDelegate next, IOcelotLoggerFactory loggerFactory, IRequestScopedDataRepository requestScopedDataRepository, IRateLimitCounterHandler counterHandler) : base(requestScopedDataRepository) { _next = next; _logger = loggerFactory.CreateLogger <ClientRateLimitMiddleware>(); _counterHandler = counterHandler; _processor = new ClientRateLimitProcessor(counterHandler); }
public ClientRateLimitMiddlewareTests() { _url = "http://localhost:51879"; var cacheEntryOptions = new MemoryCacheOptions(); _rateLimitCounterHandler = new MemoryCacheRateLimitCounterHandler(new MemoryCache(cacheEntryOptions)); _loggerFactory = new Mock <IOcelotLoggerFactory>(); _logger = new Mock <IOcelotLogger>(); _loggerFactory.Setup(x => x.CreateLogger <ClientRateLimitMiddleware>()).Returns(_logger.Object); _next = context => Task.CompletedTask; _middleware = new ClientRateLimitMiddleware(_next, _loggerFactory.Object, _rateLimitCounterHandler); }
public ClientRateLimitMiddlewareTests() { _url = "http://localhost:51879"; var cacheEntryOptions = new MemoryCacheOptions(); _rateLimitCounterHandler = new MemoryCacheRateLimitCounterHandler(new MemoryCache(cacheEntryOptions)); var httpContext = new DefaultHttpContext(); _downstreamContext = new DownstreamContext(httpContext); _downstreamContext.HttpContext.Response.Body = new FakeStream(); _loggerFactory = new Mock <IOcelotLoggerFactory>(); _logger = new Mock <IOcelotLogger>(); _loggerFactory.Setup(x => x.CreateLogger <ClientRateLimitMiddleware>()).Returns(_logger.Object); _next = async(context) => { }; _middleware = new ClientRateLimitMiddleware(_next, _loggerFactory.Object, _rateLimitCounterHandler); }
public ClientRateLimitProcessor(IRateLimitCounterHandler counterHandler) { _counterHandler = counterHandler; _core = new RateLimitCore(_counterHandler); }
public RateLimitCore(IRateLimitCounterHandler counterStore) { _counterHandler = counterStore; }
public RateLimitCore(IRateLimitCounterHandler counterHandler) { _counterHandler = counterHandler; }
public RateLimitProcessor(RateLimitOptions rateLimitOptions, IRateLimitCounterHandler rateLimitCounterHandler) { _rateLimitOptions = rateLimitOptions; _rateLimitCounterHandler = rateLimitCounterHandler; }