From bf9212d0705b13bf34b18f5d382f3c0591cd54af Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Fri, 14 Jun 2024 10:29:28 +0100 Subject: [PATCH] Drop HTML line breaks on long headers --- rest_framework/templates/rest_framework/base.html | 2 +- rest_framework/templatetags/rest_framework.py | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/rest_framework/templates/rest_framework/base.html b/rest_framework/templates/rest_framework/base.html index 7f16482b78..e261d8c9d5 100644 --- a/rest_framework/templates/rest_framework/base.html +++ b/rest_framework/templates/rest_framework/base.html @@ -176,7 +176,7 @@

{{ name }}

HTTP {{ response.status_code }} {{ response.status_text }}{% for key, val in response_headers|items %}
-{{ key }}: {{ val|break_long_headers|urlize }}{% endfor %}
+{{ key }}: {{ val|urlize }}{% endfor %}
 
 {{ content|urlize }}
diff --git a/rest_framework/templatetags/rest_framework.py b/rest_framework/templatetags/rest_framework.py index e01568cf2c..3ff74e7cc2 100644 --- a/rest_framework/templatetags/rest_framework.py +++ b/rest_framework/templatetags/rest_framework.py @@ -313,14 +313,3 @@ def smart_urlquote_wrapper(matched_url): return smart_urlquote(matched_url) except ValueError: return None - - -@register.filter -def break_long_headers(header): - """ - Breaks headers longer than 160 characters (~page length) - when possible (are comma separated) - """ - if len(header) > 160 and ',' in header: - header = mark_safe('
' + ',
'.join(header.split(','))) - return header