jsocol / django-ratelimit

Cache-based rate-limiting for Django
https://django-ratelimit.readthedocs.io/en/latest/
Other
1.07k stars 187 forks source link

Documentation example issue #319

Open minusf opened 5 months ago

minusf commented 5 months ago

The first example comment seems to be only partially correct: https://github.com/jsocol/django-ratelimit/blob/main/docs/usage.rst?plain=1#L84:

@ratelimit(key='ip', rate='5/m', block=False)
def myview(request):
    # Will be true if the same IP makes more than 5 POST
    # requests/minute.
    was_limited = getattr(request, 'limited', False)
    return HttpResponse()

In my understanding by default method is ALL, so while 5 POSTs will trigger the rate limiting, so would any other request methods.