Testing HTTP Adapter URL Path Normalization in Requests Library
This test suite focuses on validating the HTTP adapter functionality in the Requests library, specifically examining URL path handling and normalization. It ensures proper handling of URL paths with leading separators to maintain consistent request formatting.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
psf/requests
tests/test_adapters.py
import requests.adapters
def test_request_url_trims_leading_path_separators():
"""See also https://github.com/psf/requests/issues/6643."""
a = requests.adapters.HTTPAdapter()
p = requests.Request(method="GET", url="http://127.0.0.1:10000//v:h").prepare()
assert "/v:h" == a.request_url(p, {})