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

Function make_request

tests/test_signal_integration.py:59–70  ·  view source on GitHub ↗

Make a simple HTTP request and return the response body.

(host, port, path='/')

Source from the content-addressed store, hash-verified

57
58
59def make_request(host, port, path='/'):
60 """Make a simple HTTP request and return the response body."""
61 with socket.create_connection((host, port), timeout=5) as sock:
62 request = f'GET {path} HTTP/1.1\r\nHost: {host}\r\nConnection: close\r\n\r\n'
63 sock.sendall(request.encode())
64 response = b''
65 while True:
66 chunk = sock.recv(4096)
67 if not chunk:
68 break
69 response += chunk
70 return response
71
72
73@pytest.fixture

Calls 3

encodeMethod · 0.80
sendallMethod · 0.45
recvMethod · 0.45

Tested by

no test coverage detected