mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 09:36:49 +03:00
Drop HTML line breaks on long headers
This commit is contained in:
parent
9864c47018
commit
bf9212d070
|
@ -176,7 +176,7 @@
|
||||||
|
|
||||||
<div class="response-info" aria-label="{% trans "response info" %}">
|
<div class="response-info" aria-label="{% trans "response info" %}">
|
||||||
<pre class="prettyprint"><span class="meta nocode"><b>HTTP {{ response.status_code }} {{ response.status_text }}</b>{% for key, val in response_headers|items %}
|
<pre class="prettyprint"><span class="meta nocode"><b>HTTP {{ response.status_code }} {{ response.status_text }}</b>{% for key, val in response_headers|items %}
|
||||||
<b>{{ key }}:</b> <span class="lit">{{ val|break_long_headers|urlize }}</span>{% endfor %}
|
<b>{{ key }}:</b> <span class="lit">{{ val|urlize }}</span>{% endfor %}
|
||||||
|
|
||||||
</span>{{ content|urlize }}</pre>
|
</span>{{ content|urlize }}</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -313,14 +313,3 @@ def smart_urlquote_wrapper(matched_url):
|
||||||
return smart_urlquote(matched_url)
|
return smart_urlquote(matched_url)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return None
|
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('<br> ' + ', <br>'.join(header.split(',')))
|
|
||||||
return header
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user