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

Improve InvalidURL error message. #3250

Merged
merged 7 commits into from
Jul 26, 2024

Conversation

tomchristie
Copy link
Member

@tomchristie tomchristie commented Jul 25, 2024

Prompted by #3248.

before...

>>> import httpx
>>> httpx.get("https://www.example.com\n")
Traceback (most recent call last):
  ...
  File "/Users/tomchristie/GitHub/encode/httpx/httpx/_urlparse.py", line 163, in urlparse
    raise InvalidURL(error)
httpx.InvalidURL: Invalid non-printable ASCII character in URL.

after...

>>> import httpx
>>> httpx.get("https://www.example.com\n")
Traceback (most recent call last):
  ...
  File "/Users/tomchristie/GitHub/encode/httpx/httpx/_urlparse.py", line 168, in urlparse
    raise InvalidURL(error)
httpx.InvalidURL: Invalid non-printable ASCII character in URL, '\n' at position 23.

@tomchristie tomchristie added the user-experience Ensuring that users have a good experience using the library label Jul 25, 2024
@tomchristie tomchristie marked this pull request as ready for review July 25, 2024 10:44
@tomchristie tomchristie requested a review from a team July 25, 2024 11:10
Copy link
Member

@adriangb adriangb left a comment

Choose a reason for hiding this comment

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

Minor nits

httpx/_urlparse.py Outdated Show resolved Hide resolved
httpx/_urlparse.py Outdated Show resolved Hide resolved
@tomchristie tomchristie merged commit 7c0cda1 into master Jul 26, 2024
5 checks passed
@tomchristie tomchristie deleted the improve-invalid-url-error-message branch July 26, 2024 08:36
@mbeijen mbeijen mentioned this pull request Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user-experience Ensuring that users have a good experience using the library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants