Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map UnsupportedProtocol to InvalidURL #1904

Conversation

aminalaee
Copy link
Member

@aminalaee aminalaee commented Oct 20, 2021

Refs #1832 .

Updates mapping to raise InvalidURL for UnsupportedProtocol exceptions from httpcore.
Not sure if this is the best approach.

Any feedback is appreciated.

httpx.get("https://example<>.com")

with pytest.raises(httpx.InvalidURL):
httpx.get("https://🦋")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really sure if this is the best place for tests.

@@ -66,8 +64,3 @@ def test_stream(server):
assert response.reason_phrase == "OK"
assert response.text == "Hello, world!"
assert response.http_version == "HTTP/1.1"


def test_get_invalid_url():
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a duplicate.

@tomchristie
Copy link
Member

I think... we probably need to dig into expected behaviours a little more here, before pushing on with changes.

I'm going to discuss this against this issue itself...

@aminalaee
Copy link
Member Author

aminalaee commented Oct 20, 2021

@tomchristie Agreed. This will basically omit UnsupportedProtocol.
Needs more discussion. Maybe this change should start from httpcore ?

@aminalaee aminalaee marked this pull request as draft October 20, 2021 09:28
@aminalaee aminalaee closed this Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants