purell icon indicating copy to clipboard operation
purell copied to clipboard

Use net/url .String()

Open natasha-jarus opened this issue 11 months ago • 0 comments

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 avatar Mar 19 '24 00:03 natasha-jarus