File tree Expand file tree Collapse file tree 1 file changed +0
-36
lines changed
src/Throttlr.Api.RateLimit/Middleware Expand file tree Collapse file tree 1 file changed +0
-36
lines changed Original file line number Diff line number Diff line change @@ -56,41 +56,5 @@ private static string ResolveClientKey(HttpContext context)
5656 // Default: use IP address. Could be swapped for API key / user ID.
5757 return context . Connection . RemoteIpAddress ? . ToString ( ) ?? "unknown" ;
5858 }
59-
60- ///// <summary>
61- ///// Processes the HTTP request, applying rate limiting.
62- ///// </summary>
63- //public async Task InvokeAsync(HttpContext context)
64- //{
65- // var requestKey = context.Connection.RemoteIpAddress?.ToString() ?? "unknown";
66-
67- // var rateLimitContext = new RateLimitContext(requestKey);
68- // var result = await _rateLimiter.CheckAsync(rateLimitContext, context.RequestAborted);
69-
70- // if (!result.Allowed)
71- // {
72- // context.Response.StatusCode = StatusCodes.Status429TooManyRequests;
73-
74- // if (result.RetryAfter.HasValue)
75- // {
76- // context.Response.Headers["Retry-After"] =
77- // ((int)result.RetryAfter.Value.TotalSeconds).ToString();
78- // }
79-
80- // if (result.Reset.HasValue)
81- // {
82- // context.Response.Headers["X-RateLimit-Reset"] =
83- // ((int)result.Reset.Value.TotalSeconds).ToString();
84- // }
85-
86- // context.Response.Headers["X-RateLimit-Remaining"] = "0";
87- // return;
88- // }
89-
90- // context.Response.Headers["X-RateLimit-Remaining"] =
91- // result.Remaining?.ToString() ?? "unknown";
92-
93- // await _next(context);
94- //}
9559 }
9660}
You can’t perform that action at this time.
0 commit comments