jsondjangoheaderresponsejsonresponse

Django JsonResponse customize its header


I want to change response header of

> from django.http import JsonResponse

function for example change Date header how?


Solution

  • You can alter it as a key-value dictionary, so:

    from django.http import JsonResponse
    
    response = JsonResponse()
    response['Date'] = 'some value'
    return response