| 123456789101112131415161718192021222324252627 |
- from pathlib import Path
- from httphound.main import BaseProxyTest, BackendConfig, ProxyConfig
- class ExampleLogicTest(BaseProxyTest):
- """Test to demonstrate how to use internal variable to perform some
- actions.
- """
- def __init__(self):
- super().__init__()
- self.description = "Example logic test"
- self.proxy_config = ProxyConfig(
- binary_path=Path.home() / "bin/haproxy"
- )
- def run_test(self):
- # Perform 2 requests with different headers
- self.headers = {"X-Test": "1234"}
- res1 = self.make_request()
- print(f"Response 1 {res1}")
- # Check headers received by the backend
- print(self.backend.received_headers)
- self.headers = {"X-Another": "abcd"}
- res2 = self.make_request()
- print(f"Response 2 {res2}")
- print(self.backend.received_headers)
- return True
|