from django.http import JsonResponse
def debug_header(request): keys_to_remove = ['XDG_SESSION_ID', 'SHELL', 'TERM', 'OLDPWD', 'HISTFILESIZE', 'USER', 'LS_COLORS', 'VIRTUAL_ENV', 'MAIL', 'PATH', 'PWD', 'LANG', 'wsgi.input', 'wsgi.errors', 'wsgi.file_wrapper', 'HISTSIZE', 'PS1', 'HISTCONTROL', 'SHLVL', 'HOME', 'LOGNAME', 'LESSOPEN', '_', 'DJANGO_SETTINGS_MODULE', 'RUN_MAIN', 'GATEWAY_INTERFACE', 'wsgi.version', 'wsgi.run_once', 'wsgi.multithread', 'wsgi.multiprocess'] headers = {key: value for key, value in request.META.items() if key not in keys_to_remove} print(f"headers:{type(headers)}: {headers}") # return HttpResponse(str(headers)) return JsonResponse(headers)
|