middlewares: clean stored request on exceptions (#22864)

This commit is contained in:
Benjamin Dauvergne 2018-03-28 21:20:34 +02:00
parent bbb341f571
commit ef736f42bd
1 changed files with 3 additions and 0 deletions

View File

@ -134,6 +134,9 @@ class StoreRequestMiddleware(object):
StoreRequestMiddleware.collection.pop(threading.currentThread(), None)
return response
def process_exception(self, request, exception):
StoreRequestMiddleware.collection.pop(threading.currentThread(), None)
@classmethod
def get_request(cls):
return cls.collection.get(threading.currentThread())