Skip to content

Commit 59526b0

Browse files
committed
Revert "Support show_env param in /headers", reverting postmanlabs#457. Fixed postmanlabs#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 31ffe79.
1 parent fce4d83 commit 59526b0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

httpbin/core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ def view_headers():
342342
description: The request's headers.
343343
"""
344344

345-
return jsonify(get_headers())
345+
return jsonify(get_dict('headers'))
346346

347347

348348
@app.route("/user-agent")

test_httpbin.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def test_headers(self):
279279
}
280280
response = self.app.get('/headers', headers=headers)
281281
self.assertEqual(response.status_code, 200)
282-
self.assertTrue({'Accept', 'Host', 'User-Agent'}.issubset(set(response.json.keys())))
282+
self.assertTrue({'Accept', 'Host', 'User-Agent'}.issubset(set(response.json['headers'].keys())))
283283
self.assertNotIn('Via', response.json)
284284

285285
def test_headers_show_env(self):
@@ -291,7 +291,7 @@ def test_headers_show_env(self):
291291
}
292292
response = self.app.get('/headers?show_env=true', headers=headers)
293293
self.assertEqual(response.status_code, 200)
294-
self.assertTrue({'Accept', 'Host', 'User-Agent', 'Via'}.issubset(set(response.json.keys())))
294+
self.assertTrue({'Accept', 'Host', 'User-Agent', 'Via'}.issubset(set(response.json['headers'].keys())))
295295

296296
def test_user_agent(self):
297297
response = self.app.get(

0 commit comments

Comments
 (0)