3 ms·
It's okay, since cookies is a Map[String, String] so running the get returns an Option[String]. If the author is concerned, the way to express this to be more
by mark242 10y ago
It's okay, since cookies is a Map[String, String] so running the get returns an Option[String].
If the author is concerned, the way to express this to be more expressive could be something like this:
val uidOpt: Option[Long] = request.cookies.get("uid") map {
case Some(uidStr) if uidStr.toLong > 0 => Some(uidStr.toLong)
case _ => None
}