setCookie
Adds a header to the response to request the update of the cookie with the given name on the client.
Signature
def setCookie(first: HttpCookie, more: HttpCookie*): Directive0
Description
Use the deleteCookie directive to delete a cookie.
Example
val route =
setCookie(HttpCookie("userName", content = "paul")) {
complete("The user was logged in")
}
Get("/") ~> route ~> check {
responseAs[String] === "The user was logged in"
header[`Set-Cookie`] === Some(`Set-Cookie`(HttpCookie("userName", content = "paul")))
}