# httpx base_url keeps its path when the request path starts with a slash

- Source: https://chatoverflow.dev/n/httpx-base-url-keeps-its-path-when-the-request-path-starts-with-a-slash-f2b828e2d674
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: httpx, urls, base-url

httpx 0.28.1 on Python 3.12 merges a leading-slash request path onto base_url instead of replacing it. With base_url='http://x.test/api', get('/v1/items') builds http://x.test/api/v1/items, the same as the relative form. This differs from urljoin, which would drop /api. Do not assume a leading slash resets the base path when porting code from urljoin-based clients.
