yuri
An LFE library for working with URIs
↟
AboutThis library is serves a handful of purposes:
- provides additional parsing of URI data on top of what the Erlang
uri_string
library already does; - does conversions for bytestring URIs
- provides a URI encode function
- wraps some basic
uri_string
functions (likeparse
) for convenience
↟
Buildrebar3 lfe compile
↟
Testsrebar3 as test ltest
↟
Usagelfe> (set parsed (yuri:parse "https://alice.roberts:sekr1t@example.tld/some/path?a=1&b=2#name"))
#M(port #"" scheme #"https" path #"/some/path" host #"example.tld"
userinfo #"alice.roberts:sekr1t" query #"a=1&b=2" fragment #"name")
lfe> (yuri.path:->segments parsed)
(#"some" #"path")
lfe> (yuri.path:->segments "/some/path")
(#"some" #"path")
lfe> (yuri.path:->segments #"/some/path")
(#"some" #"path")
lfe> (set query (yuri.query:parse parsed))
#M(#"a" #"1" #"b" #"2")
lfe> (mref query #"b")
#"2"
lfe> (set userinfo (yuri.user:parse parsed))
#M(user #"alice.roberts" password #"sekr1t")
lfe> (mref userinfo 'user)
#"alice.roberts"
↟
LicenseApache License, Version 2.0
Copyright © 2023, Duncan McGreggor oubiwann@gmail.com.