From 86928164010c412f7a5583a7b36e580f281b5a59 Mon Sep 17 00:00:00 2001 From: Andrei Fokau Date: Wed, 18 Nov 2015 15:52:57 +0100 Subject: [PATCH] Sort response headers in api renderer to keep the same order --- rest_framework/renderers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rest_framework/renderers.py b/rest_framework/renderers.py index ba4d60881..86e8cba55 100644 --- a/rest_framework/renderers.py +++ b/rest_framework/renderers.py @@ -9,6 +9,7 @@ REST framework also provides an HTML renderer that renders the browsable API. from __future__ import unicode_literals import json +from collections import OrderedDict import django 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_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 = '' if renderer: renderer_content_type = '%s' % renderer.media_type