mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-08-26 06:09:41 +00:00
response 308 in force update
This commit is contained in:
@ -18,9 +18,9 @@ from guardian.models import Guardian
|
|||||||
# user can login in single
|
# user can login in single
|
||||||
# device at a time"""
|
# device at a time"""
|
||||||
|
|
||||||
def custom_response(custom_error):
|
def custom_response(custom_error, response_status = status.HTTP_404_NOT_FOUND):
|
||||||
"""custom response"""
|
"""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"
|
# Set content type header to "application/json"
|
||||||
response['Content-Type'] = 'application/json'
|
response['Content-Type'] = 'application/json'
|
||||||
# Render the response as JSON
|
# Render the response as JSON
|
||||||
@ -64,5 +64,5 @@ class CustomMiddleware(object):
|
|||||||
if not force_update and version and device_type:
|
if not force_update and version and device_type:
|
||||||
custom_error = custom_error_response(ERROR_CODE['2079'],
|
custom_error = custom_error_response(ERROR_CODE['2079'],
|
||||||
response_status=status.HTTP_308_PERMANENT_REDIRECT)
|
response_status=status.HTTP_308_PERMANENT_REDIRECT)
|
||||||
response = custom_response(custom_error)
|
response = custom_response(custom_error, status.HTTP_308_PERMANENT_REDIRECT)
|
||||||
return response
|
return response
|
||||||
|
Reference in New Issue
Block a user