-
Notifications
You must be signed in to change notification settings - Fork 160
write sample using service for rate limit #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@Kahbazi can you do this issue? |
IServiceCollection AddRateLimiter won't be available until the next release. |
I didn't quite understand the purpose of this issue. We could update some samples in https://github.com/dotnet/AspNetCore.Docs.Samples/blob/257f38f079bd0dd41824a6ef452a6ce838ecdb04/fundamentals/middleware/rate-limit/WebRateLimitAuth/Program.cs to use Do we need to write new samples just for using I suggest we update all samples to use |
Per this comment, add sample code with attribute
|
@Kahbazi Use a service per #13 (comment)
So just rewrite the code so it's not using Would you be able to update all the code to use the service approach? Wasn't that the intention of the comment? Do you think that's a better approach? And add any new features in rate limiting that we want to document that have been added since this sample was written. |
@fiyazbinhasan @Elfocrash @sammychinedu2ky @martincostello are you interested in changing the sample to use Use a service per #13 (comment)
|
I would like to take a look at it if no one has already started. However, the current sample is not runnable. I'll try to fix it along the way. |
Thanks, it's all yours. |
Wrong issue, ignore public class SampleProblemDetailsWriter : IProblemDetailsWriter
{
public bool CanWrite(ProblemDetailsContext context)
=> context.HttpContext.Response.StatusCode == 400;
public ValueTask WriteAsync(ProblemDetailsContext context)
{
//Additional customizations
// Write to the response
return new ValueTask(context.HttpContext.Response.WriteAsJsonAsync(context.ProblemDetails));
}
} From this comment |
Use a service per #13 (comment)
Put the code in this folder and delete the
readme.md
.The text was updated successfully, but these errors were encountered: