Skip to content

Raise InvalidURL when a request URL has a scheme but no host - #3893

Open
MadhurBagdare wants to merge 1 commit into
encode:masterfrom
MadhurBagdare:fix-invalid-url-missing-host
Open

MadhurBagdare wants to merge 1 commit into
encode:masterfrom
MadhurBagdare:fix-invalid-url-missing-host

Conversation

@MadhurBagdare

Copy link
Copy Markdown

httpx.get("https:/google.com") and httpx.get("https:///google.com") raise UnsupportedProtocol. The scheme is dropped while the URL is merged, and a client with a base URL rewrites the request onto that host instead.

A request URL with a scheme and no host should raise InvalidURL.

Fixes #1832

pytest tests/client/test_client.py::test_get_url_with_scheme_and_no_host tests/client/test_client.py::test_scheme_without_host_is_not_joined_onto_base_url

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent Handling of Invalid Urls

1 participant