Merge pull request #3655 from andreif/fix/headers-order

Sort response headers in api renderer
This commit is contained in:
Tom Christie 2015-11-18 17:25:54 +00:00
commit 378b7b8963

View File

@ -9,6 +9,7 @@ REST framework also provides an HTML renderer that renders the browsable API.
from __future__ import unicode_literals from __future__ import unicode_literals
import json import json
from collections import OrderedDict
import django import django
from django import forms from django import forms
@ -618,7 +619,7 @@ class BrowsableAPIRenderer(BaseRenderer):
raw_data_patch_form = self.get_raw_data_form(data, view, 'PATCH', request) raw_data_patch_form = self.get_raw_data_form(data, view, 'PATCH', request)
raw_data_put_or_patch_form = raw_data_put_form or raw_data_patch_form raw_data_put_or_patch_form = raw_data_put_form or raw_data_patch_form
response_headers = dict(response.items()) response_headers = OrderedDict(sorted(response.items()))
renderer_content_type = '' renderer_content_type = ''
if renderer: if renderer:
renderer_content_type = '%s' % renderer.media_type renderer_content_type = '%s' % renderer.media_type