Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions rest_framework_simplejwt/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,11 @@ class TokenBlacklistView(TokenViewBase):

_serializer_class = api_settings.TOKEN_BLACKLIST_SERIALIZER

def post(self, request: Request, *args, **kwargs) -> Response:
response = super().post(request, *args, **kwargs)
serializer_data = response.data
serializer_data['Token detail'] = 'Token blacklisted'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be changed to match a descriptive message such as that in the test, Token detail should be message.

Can you send in a fix?

serializer_data['message'] = 'Token blacklisted'

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi thanks for your attention, sure as soon as possible


return Response(serializer_data, status=response.status_code)

token_blacklist = TokenBlacklistView.as_view()
2 changes: 1 addition & 1 deletion tests/test_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ def test_it_should_return_nothing_if_everything_ok(self):
fake_aware_utcnow.return_value = now
self.assertTrue(s.is_valid())

self.assertDictEqual(s.validated_data, {})
self.assertDictEqual(s.validated_data, {"message": "Token blacklisted"})

def test_it_should_blacklist_refresh_token_if_everything_ok(self):
self.assertEqual(OutstandingToken.objects.count(), 0)
Expand Down