Support encoding of path segments
markslater opened this issue · 0 comments
markslater commented
When building URLs, it would be useful to be able to encode individual path segments, so that they can contain reserved characters such as /
.
For example, suppose I have a variable that contains the name of a band. I should be able to build up a URL that contains the name of the band as one of the path segments, e.g.
Band Name | URL |
---|---|
Pink Floyd | http://example.com/bands/Pink%20Floyd |
AC/DC | http://example.com/bands/AC%2FDC |
I think this is just a case of exposing the encodeSegment
function, which would mean I could write:
path = '/' .. url.encodeSegment('band') .. '/' .. url.encodeSegment('AC/DC')