chibisov / drf-extensions

DRF-extensions is a collection of custom extensions for Django REST Framework

Home Page:http://chibisov.github.io/drf-extensions/docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CacheResponse assumes a pickle serializer is used, breaking on any other serializers

gcbirzan opened this issue · comments

As per the WSGI spec, headers must be a list of tuples. If you use a serialization format that doesn't support tuples (i.e. any that's not pickle), headers will end up being a list of lists. This then breaks if you try to use % to format the values.

This is the bit of code that causes this. A solution would be to iterate through the headers and use __setitem__ as that will take care of putting tuples.

PR is welcome :)