mirror of
https://github.com/kennethreitz/httpbin.git
synced 2026-06-05 23:00:18 +00:00
Merge pull request #298 from Sjord/response-headers-without-content-length
Don't check Content-Length header anymore
This commit is contained in:
+4
-3
@@ -312,10 +312,10 @@ def view_status_code(codes):
|
||||
def response_headers():
|
||||
"""Returns a set of response headers from the query string """
|
||||
headers = MultiDict(request.args.items(multi=True))
|
||||
response = jsonify(headers.lists())
|
||||
response = jsonify(list(headers.lists()))
|
||||
|
||||
while True:
|
||||
content_len_shown = response.headers['Content-Length']
|
||||
original_data = response.data
|
||||
d = {}
|
||||
for key in response.headers.keys():
|
||||
value = response.headers.get_all(key)
|
||||
@@ -325,7 +325,8 @@ def response_headers():
|
||||
response = jsonify(d)
|
||||
for key, value in headers.items(multi=True):
|
||||
response.headers.add(key, value)
|
||||
if response.headers['Content-Length'] == content_len_shown:
|
||||
response_has_changed = response.data != original_data
|
||||
if not response_has_changed:
|
||||
break
|
||||
return response
|
||||
|
||||
|
||||
Reference in New Issue
Block a user