Last active
March 3, 2025 05:04
-
-
Save joshuakfarrar/563bff634c525a9224cf7ac3965a409f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is our possible base64-encoded byte array — serialized — flash cookie | |
val flashCookie: Option[String] = request.headers | |
.get[Cookie] | |
.flatMap(_.values.find(_.name == "flash")) | |
.map(_.content) | |
// aquí tienes, voilà | |
flashCookie.map(_.decode).sequence.fold( | |
_ => BadRequest("failed to deserialize cookie, this is very bad"), | |
cookie => Ok(renderPage(cookie)) // or do whatever we want with our freshly baked Option[Map[String, String]] | |
) // F[Response[F]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment