From 59526b0915e2bb4a7ca0ac3b0ff33f39dc4396c9 Mon Sep 17 00:00:00 2001 From: Brett Randall Date: Wed, 25 Jul 2018 11:55:59 +1000 Subject: [PATCH] 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 31ffe79981a079d6605352d2d84de2f2d27ab6db. --- httpbin/core.py | 2 +- test_httpbin.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/httpbin/core.py b/httpbin/core.py index 913bccc..fd3c488 100644 --- a/httpbin/core.py +++ b/httpbin/core.py @@ -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") diff --git a/test_httpbin.py b/test_httpbin.py index d24a8b5..b7104ff 100755 --- a/test_httpbin.py +++ b/test_httpbin.py @@ -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(