deleteCookie

deleteCookie

Signature

Description

Adds a header to the response to request the removal of the cookie with the given name on the client.

Use the setCookie directive to update a cookie.

Example

val route =
  deleteCookie("userName") {
    complete("The user was logged out")
  }

// tests:
Get("/") ~> route ~> check {
  responseAs[String] shouldEqual "The user was logged out"
  header[`Set-Cookie`] shouldEqual Some(`Set-Cookie`(HttpCookie("userName", value = "deleted", expires = Some(DateTime.MinValue))))
}

Contents