parse/1
and new/1
TIL the difference between URI.new/1
and URI.parse/1
in Elixir 1.13.
new/1
does a bunch of validation to ensure the URI is within specparse/1
does no validation at allLots of URIs in the wild are technically invalid, but web browsers handle them just fine.
Obviously URI.parse/1
is somewhat unsafe, so in our app we’ve combined it with some hand-rolled validation to ensure the URI is vaguely URL-like: