Add a Retry-After to 409 responses

This commit is contained in:
Raphael Michel
2018-11-09 11:13:24 +01:00
parent 8c34a47138
commit 901953d988

View File

@@ -10,7 +10,10 @@ def custom_exception_handler(exc, context):
if isinstance(exc, LockTimeoutException):
response = Response(
{'detail': 'The server was too busy to process your request. Please try again.'},
status=status.HTTP_409_CONFLICT
status=status.HTTP_409_CONFLICT,
headers={
'Retry-After': 5
}
)
return response