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

gh-69152: Add _proxy_response_headers attribute to HTTPConnection #26152

Merged
merged 7 commits into from
May 5, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add_test
nametkin committed Apr 29, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 367893d4b62d21f742256edbbea204a62a508c78
13 changes: 13 additions & 0 deletions Lib/test/test_httplib.py
Original file line number Diff line number Diff line change
@@ -2390,6 +2390,19 @@ def test_tunnel_debuglog(self):
lines = output.getvalue().splitlines()
self.assertIn('header: {}'.format(expected_header), lines)

def test_proxy_response_headers(self):
expected_header = ('X-Dummy', '1')
response_text = 'HTTP/1.0 200 OK\r\n{}: {}\r\n\r\n'.format(
*expected_header
)

self.conn._create_connection = self._create_connection(response_text)
self.conn.set_tunnel('destination.com')

self.conn.request('PUT', '/', '')
headers = self.conn._proxy_response_headers
self.assertIn(expected_header, headers.items())


if __name__ == '__main__':
unittest.main(verbosity=2)