deleteCookie

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

Signature

def deleteCookie(first: HttpCookie, more: HttpCookie*): Directive0 
def deleteCookie(name: String, domain: String = "", path: String = ""): Directive0 

Description

Use the setCookie directive to update a cookie.

Example

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


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