Request's
Url. Start constructing your
Url with
http or
https specifying the scheme and host at the same
time. Then use the
(/~) and
(/:)
operators to grow the path one piece at a time. Every single piece of
path will be url(percent)-encoded, so using
(/~) and
(/:) is the only way to have forward slashes between
path segments. This approach makes working with dynamic path segments
easy and safe. See examples below how to represent various
Urls
(make sure the
OverloadedStrings language extension is
enabled).
Examples
http "httpbin.org"
-- http://httpbin.org
https "httpbin.org"
-- https://httpbin.org
https "httpbin.org" /: "encoding" /: "utf8"
-- https://httpbin.org/encoding/utf8
https "httpbin.org" /: "foo" /: "bar/baz"
-- https://httpbin.org/foo/bar%2Fbaz
https "httpbin.org" /: "bytes" /~ (10 :: Int)
-- https://httpbin.org/bytes/10
https "юникод.рф"
-- https://%D1%8E%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4.%D1%80%D1%84