diff --git a/src/Throttlr.Api.RateLimit/Middleware/RateLimitingMiddleware.cs b/src/Throttlr.Api.RateLimit/Middleware/RateLimitingMiddleware.cs index f690b4d..1c0672f 100644 --- a/src/Throttlr.Api.RateLimit/Middleware/RateLimitingMiddleware.cs +++ b/src/Throttlr.Api.RateLimit/Middleware/RateLimitingMiddleware.cs @@ -56,41 +56,5 @@ private static string ResolveClientKey(HttpContext context) // Default: use IP address. Could be swapped for API key / user ID. return context.Connection.RemoteIpAddress?.ToString() ?? "unknown"; } - - ///// - ///// Processes the HTTP request, applying rate limiting. - ///// - //public async Task InvokeAsync(HttpContext context) - //{ - // var requestKey = context.Connection.RemoteIpAddress?.ToString() ?? "unknown"; - - // var rateLimitContext = new RateLimitContext(requestKey); - // var result = await _rateLimiter.CheckAsync(rateLimitContext, context.RequestAborted); - - // if (!result.Allowed) - // { - // context.Response.StatusCode = StatusCodes.Status429TooManyRequests; - - // if (result.RetryAfter.HasValue) - // { - // context.Response.Headers["Retry-After"] = - // ((int)result.RetryAfter.Value.TotalSeconds).ToString(); - // } - - // if (result.Reset.HasValue) - // { - // context.Response.Headers["X-RateLimit-Reset"] = - // ((int)result.Reset.Value.TotalSeconds).ToString(); - // } - - // context.Response.Headers["X-RateLimit-Remaining"] = "0"; - // return; - // } - - // context.Response.Headers["X-RateLimit-Remaining"] = - // result.Remaining?.ToString() ?? "unknown"; - - // await _next(context); - //} } }