Visitar URL original
gh-69152: Add _proxy_response_headers attribute to HTTPConnection by nametkin · Pull Request #26152 · python/cpython · GitHub
Skip to content
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
  • Loading branch information
nametkin committed Apr 29, 2023
commit 367893d4b62d21f742256edbbea204a62a508c78
13 changes: 13 additions & 0 deletions Lib/test/test_httplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)