mirror of
https://github.com/kennethreitz/httpbin.git
synced 2026-06-05 06:46:16 +00:00
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:
+1
-1
@@ -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
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user