Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
QuvonchbekBobojonov committed Jan 29, 2025
1 parent fee1a93 commit ee4e0b5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="django-success-response",
version="1.1.0",
version="1.1.1",
description="Django app for customizing response",
author="Quvonchbek Bobojonov",
author_email="[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion src/success_response/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, data=None, headers=None, exception=False, content_type=None,
data = {'success': success, 'result': data}
else:
data = {'success': success, 'error': {
'code': status
'code': status,
**data
}}

Expand Down
3 changes: 3 additions & 0 deletions src/success_response/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ def success_exception_handler(exc, context):
)
}

if response.status_code == status.HTTP_401_UNAUTHORIZED:
data['code'] = status.HTTP_401_UNAUTHORIZED

# Wrap the error response in a standardized format using SuccessResponse.
response = SuccessResponse(
data,
Expand Down

0 comments on commit ee4e0b5

Please sign in to comment.