[Middleware code, middleware.py]
I had an error while posting an array to an endpoint (see the comment). The code expects a dictionary while [I guess] it is ok
to post a raw array (like a batch of records). Maybe the type of json.loads(request.body) can be checked, otherwise the code can be wrapped in a try... except.... Maybe the erros can also occur at the line token = request.GET.get(JWT_QUERYSTRING_ARG)
if request.method == "GET" or request.method == "POST":
token = request.GET.get(JWT_QUERYSTRING_ARG)
if not token and request.method == "POST":
if request.META.get("CONTENT_TYPE") == "application/json":
# error: AttributeError: 'list' object has no attribute 'get'
token = json.loads(request.body).get(JWT_QUERYSTRING_ARG)
if not token:
token = request.POST.get(JWT_QUERYSTRING_ARG)
else:
token = None
[Middleware code,
middleware.py
] I had an error while posting an array to an endpoint (see the comment). The code expects a dictionary while [I guess] it is ok to post a raw array (like a batch of records). Maybe the type ofjson.loads(request.body)
can be checked, otherwise the code can be wrapped in atry... except...
. Maybe the erros can also occur at the linetoken = request.GET.get(JWT_QUERYSTRING_ARG)