I am using Django rest framework, I have to add my custom data in the Response() object.
rsp = Response()
rsp['Content-Disposition'] = 'attachment; filename=%s' % os.path.basename(file)
rsp['X-Accel-Redirect'] = '/export/%s' % file
I want to add custome dict in the data part of this Response()
Hence I tried this,
data = {'length': 10}
rsp = Response(data)
and
data = {'length': 10}
rsp = Response()
rsp['data'] = data
But I was getting error as 'error:{'data'}'
Help me to understand why this behaviour occurred and How to add custom data in Response()