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:
Dulmandakh 2016-08-05 21:30:58 +09:00 committed by GitHub
parent 35320b1f2d
commit 2198ab9284

View File

@ -118,6 +118,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: