Represents a HttpRequest URI.
Represents a HttpRequest URI.
You have several different options for constructing Uri:
scala> val uri1 = uri"http://google.com" uri1: hammock.Uri = Uri(Some(http),None,google.com,Map(),None) scala> val uri2 = Uri(None, None, "path", Map(), None) uri2: hammock.Uri = Uri(None,None,path,Map(),None) scala> val uri3 = Uri.fromString("http://google.com") uri3: Either[String,hammock.Uri] = Right(Uri(Some(http),None,google.com,Map(),None))
scheme of the uri. For example https
authority of the uri. For example: user:[email protected]:443
path of the uri. For example /books/234
query string of the uri. For example ?page=3&utm_source=campaign
fragment of the uri. For example #header1
Methods providing URI query parameters building syntax Used in Uri.? method
Unsafe string interpolator allowing uri parsing.
Unsafe string interpolator allowing uri parsing. It's unsafe
because in case of any error happen (a Left is returned by the
fromString
method), it will throw an exception.
scala> uri"http://user:[email protected]/path?page=4#index" res1: hammock.Uri = Uri(Some(http),Some(user:pass),pepegar.com/path,Map(page -> 4),Some(index))