mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 20:40:14 +03:00
exclude OPTIONS requests from throttling
Browsers send OPTIONS requests an API server prior to every request to check if CORS allowed, so rates are reached half time. We could just double the rate, but other clients don't send extra requests.
This commit is contained in:
parent
35320b1f2d
commit
2198ab9284
|
@ -119,6 +119,9 @@ class SimpleRateThrottle(BaseThrottle):
|
|||
if self.rate is None:
|
||||
return True
|
||||
|
||||
if request.method == 'OPTIONS':
|
||||
return True
|
||||
|
||||
self.key = self.get_cache_key(request, view)
|
||||
if self.key is None:
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue
Block a user