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(