Revert "Support show_env param in /headers", reverting #457. Fixed #487.

The docstring typo fixes are retained, along with the additional tests,
modified to revert to the original "headers": { dict format.

The reverted change get_dict('headers') -> get_headers() was not required. The
query-string ?show_env=1 was already effective in allowing env headers to be
returned.

This partially reverts commit 31ffe79981.
This commit is contained in:
Brett Randall
2018-07-25 11:55:59 +10:00
parent fce4d83397
commit 59526b0915
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -342,7 +342,7 @@ def view_headers():
description: The request's headers.
"""
return jsonify(get_headers())
return jsonify(get_dict('headers'))
@app.route("/user-agent")
+2 -2
View File
@@ -279,7 +279,7 @@ class HttpbinTestCase(unittest.TestCase):
}
response = self.app.get('/headers', headers=headers)
self.assertEqual(response.status_code, 200)
self.assertTrue({'Accept', 'Host', 'User-Agent'}.issubset(set(response.json.keys())))
self.assertTrue({'Accept', 'Host', 'User-Agent'}.issubset(set(response.json['headers'].keys())))
self.assertNotIn('Via', response.json)
def test_headers_show_env(self):
@@ -291,7 +291,7 @@ class HttpbinTestCase(unittest.TestCase):
}
response = self.app.get('/headers?show_env=true', headers=headers)
self.assertEqual(response.status_code, 200)
self.assertTrue({'Accept', 'Host', 'User-Agent', 'Via'}.issubset(set(response.json.keys())))
self.assertTrue({'Accept', 'Host', 'User-Agent', 'Via'}.issubset(set(response.json['headers'].keys())))
def test_user_agent(self):
response = self.app.get(