Skip to content

Commit 7816ac6

Browse files
authored
Merge pull request #26 from selfmadecode/feature/code-clean-up
remove InvokeAsync method
2 parents eb25123 + f5d0972 commit 7816ac6

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

src/Throttlr.Api.RateLimit/Middleware/RateLimitingMiddleware.cs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)