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

Use net/url .String() #40

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

natasha-jarus
Copy link

@natasha-jarus natasha-jarus commented Mar 19, 2024

This PR gets most tests to pass using net/url.String() for url escaping. The only failing tests are for EncodeNecessaryEscapes and DecodeUnnecessaryEscapes, which rely on implementation details of net/url and urlesc.

It is remarkably difficult to avoid net/url's escaping logic, especially if you try to hold it "right" by using .String(), .EscapedPath(), PathJoin(), &c. My opinion is that net/url has had this escaping logic for years at this point and likely folks should be OK with it at this point.

In addition, the TestEncodeNecessaryEscapesAll is vague; as written, it tests not only the path but also query and fragment escaping, since the url string contains ? and #. It is unclear to me if we want to just test path escaping or if we care about query and fragment escaping too?

Resolves #14 unsatisfactorily.

@natasha-jarus natasha-jarus changed the title Use std url string Use net/url .String() Mar 19, 2024
@natasha-jarus natasha-jarus marked this pull request as ready for review March 19, 2024 17:41
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.

Return to using stdlib's URL escaping
1 participant