Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert #457 "Support show_env param in /headers" #492

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 31ffe79.
  • Loading branch information
javabrett committed Jul 25, 2018
commit 59526b0915e2bb4a7ca0ac3b0ff33f39dc4396c9
2 changes: 1 addition & 1 deletion httpbin/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions test_httpbin.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def test_headers(self):
}
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):
Expand All @@ -291,7 +291,7 @@ def test_headers_show_env(self):
}
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(
Expand Down