(base_url: str | httpx.URL)
| 34 | |
| 35 | |
| 36 | def _normalize_base_url(base_url: str | httpx.URL) -> httpx.URL: |
| 37 | url = httpx.URL(base_url) |
| 38 | path = url.path.rstrip("/") |
| 39 | responses_match = re.search(r"/responses(?:/.*)?$", path) |
| 40 | if responses_match is not None: |
| 41 | path = path[: responses_match.start()] |
| 42 | |
| 43 | return url.copy_with(path=path or "/") |
| 44 | |
| 45 | |
| 46 | def _same_origin(left: httpx.URL, right: httpx.URL) -> bool: |