I'm currently looking to disable certain methods for an API endpoint - as added security. I'm using the status code that DRF suggests to use, that is for my case, "HTTP_405_METHOD_NOT_ALLOWED" - however, it looks to me that although this is working, the headers still say that the method is in Allow. See screenshot below:
As you can see, I am performing a GET request - but the Allow header is saying it's fine - even tho the status code is being applied correctly.
Stripped back example code:
class TokenValidateView(APIView): def get(self, request, format=None): return Response(status=status.HTTP_405_METHOD_NOT_ALLOWED, headers=?) I believe I would need to set something in the headers dictionary (I've added ? where I'm not quite sure what needs to be done) as one of the arguments in the Response() function, but I'm not sure if this is a bug in DRF itself? Surely when that status code is passed it should be set in the headers accordingly?
N.B. I've also tried adding headers = { 'Allow': 'POST' } to the Response() argument, but that doesn't seem to work...
