uri-scala

CI Maven Central Renovate License Tokei

This library provides a simple URI parsing and model.

Installation

Add the following to your sbt build (2.13.x):

val version = "..."

libraryDependencies += Seq(
  "com.github.j5ik2o" %% "uri-scala" % version,
)

Usage

This library provides a parser for URI and a model for URI.

object Example extends App {

  val uriText = "http://example.com/abc?key1=abc"

  val uri = Uri.parseWithException(uriText)

  println(s"uri = ${uri.asString}")
  println(s"uri.scheme = ${uri.scheme.asString}")
  println(s"uri.authority = ${uri.authority.asString}")
  println(s"uri.path = ${uri.path.asString}")
  println(s"uri.query = ${uri.query.map(_.asString)}")
  println(s"uri.fragment = ${uri.fragment}")

  assert(uri.asString == uriText)

}