I'm trying to build Uri, but Query method gives me type mismatch, expected string, actual Uri.Query
def buildUri(url: String, query: Option[Map[String, String]] = None): Uri = {
val fullUrl = endpoint + (if (endpoint.endsWith("/")) url else "/" + url)
val uri: Uri = query match {
case Some(map) if map.nonEmpty =>
Uri(fullUrl.toString).copy(query = Query(map))
case _ =>
Uri(fullUrl.toString)
}
uri
}