diff --git a/account/custom_middleware.py b/account/custom_middleware.py index fb032dc..ca89a86 100644 --- a/account/custom_middleware.py +++ b/account/custom_middleware.py @@ -18,9 +18,9 @@ from guardian.models import Guardian # user can login in single # device at a time""" -def custom_response(custom_error): +def custom_response(custom_error, response_status = status.HTTP_404_NOT_FOUND): """custom response""" - response = Response(custom_error.data, status=status.HTTP_404_NOT_FOUND) + response = Response(custom_error.data, status=response_status) # Set content type header to "application/json" response['Content-Type'] = 'application/json' # Render the response as JSON @@ -64,5 +64,5 @@ class CustomMiddleware(object): if not force_update and version and device_type: custom_error = custom_error_response(ERROR_CODE['2079'], response_status=status.HTTP_308_PERMANENT_REDIRECT) - response = custom_response(custom_error) + response = custom_response(custom_error, status.HTTP_308_PERMANENT_REDIRECT) return response