@@ -1529,10 +1529,11 @@ class ApiPrefixesToken(APIView):
15291529
15301530 --------------------
15311531
1532- Get all available prefixes and their associated permissions for a given token.
1533- The word 'Token' must be included in the header.
1532+ Get all available prefixes and their associated permissions for a given
1533+ token. The word 'Token' must be included in the header.
15341534
1535- For example: 'Token 627626823549f787c3ec763ff687169206626149'.
1535+ For example: 'Token 627626823549f787c3ec763ff687169206626149'. Using that
1536+ token will return an empty list, as that is test user.
15361537 """
15371538
15381539 auth = [
@@ -1547,18 +1548,20 @@ class ApiPrefixesToken(APIView):
15471548 @swagger_auto_schema (
15481549 manual_parameters = auth ,
15491550 responses = {
1550- 200 : "The Authorization header was provided and available prefixes were returned." ,
1551- 400 : "The Authorization header was not provided." ,
1551+ 200 : "The available prefixes were returned." ,
1552+ 401 : "The authorization header was not provided." ,
1553+ 403 : "Invalid token." ,
15521554 },
15531555 tags = ["Prefix Management" ],
15541556 )
15551557 def post (self , request ) -> Response :
15561558 if "Authorization" in request .headers :
1557- # Pass the request to the handling function
1558- # Source: https://stackoverflow.com/a/31813810
15591559 return post_api_prefixes_token_flat (request = request )
15601560 else :
1561- return Response (status = status .HTTP_400_BAD_REQUEST )
1561+ return Response (
1562+ data = {"detail" : "The authorization header was not provided." },
1563+ status = status .HTTP_401_UNAUTHORIZED
1564+ )
15621565
15631566
15641567class ApiPrefixesTokenFlat (APIView ):
0 commit comments