MCPcopy
hub / github.com/benoitc/gunicorn / test_trailers

Function test_trailers

examples/http2_features/test_http2.py:178–200  ·  view source on GitHub ↗

Test response trailers.

(host, port)

Source from the content-addressed store, hash-verified

176
177
178def test_trailers(host, port):
179 """Test response trailers."""
180 print("\n=== Testing Response Trailers ===")
181
182 try:
183 sock, h2_conn = create_h2_connection(host, port)
184
185 response = h2_request(sock, h2_conn, 1, 'GET', '/trailers', f'{host}:{port}')
186 print(f"Status: {response['status']}")
187 print(f"Headers: {response['headers']}")
188
189 if response['trailers']:
190 print(f"Trailers received: {response['trailers']}")
191 if 'content-md5' in response['trailers']:
192 print(f" Content-MD5: {response['trailers']['content-md5']}")
193 else:
194 print("Note: No trailers received (client may not have advertised support)")
195
196 sock.close()
197 return response['status'] == 200
198 except Exception as e:
199 print(f"ERROR: {e}")
200 return False
201
202
203def test_combined(host, port):

Callers 1

mainFunction · 0.85

Calls 3

create_h2_connectionFunction · 0.85
h2_requestFunction · 0.85
closeMethod · 0.45

Tested by

no test coverage detected