url
url copied to clipboard
Use percentEncode on path segments in Url.Builder
Example:
> Url.Builder.absolute [ "foo", "/", "bar" ] []
"/foo///bar" : String
Should be /foo%2Fbar, right?
I've seen #21, didn't read the spec, but here's what the Wikipedia article says about this concrete case:
The reserved character /, for example, if used in the "path" component of a URI, has the special meaning of being a delimiter between path segments. If, according to a given URI scheme, / needs to be in a path segment, then the three characters %2F or %2f must be used in the segment instead of a raw /.
I've run across this while debugging an issue in our application with Mapbox search API returning errors on punctuation/special symbols (the URL looks like https://api.mapbox.com/geocoding/v5/mapbox.places/<query>.json).
The same occurs when there are = in a query parameter.
I had to use percentEncode and percentDecode manually to work around that issue.