Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In clojure/ring, how do I delete a cookie?

Suppose I want to delete a cookie (for example, ring's session cookie):

Making a response map like this:

{:cookies {"ring-session" {:value "kill", :max-age 1}}}

seems to work, but it feels a bit hacky.

Is there a clean way to just delete it?

like image 379
John Lawrence Aspden Avatar asked Jan 10 '13 13:01

John Lawrence Aspden


People also ask

What is ring Clojure?

Ring is a Clojure web applications library inspired by Python's WSGI and Ruby's Rack. By abstracting the details of HTTP into a simple, unified API, Ring allows web applications to be constructed of modular components that can be shared among a variety of applications, web servers, and web frameworks.


1 Answers

That seems like quite a reasonable way of going about it. Many web a applications delete cookies be replacing them with one that is about to expire. The :max-age 1 syntax makes this look much more elegant than it does in, for example, Javascript.

like image 92
Arthur Ulfeldt Avatar answered Sep 23 '22 03:09

Arthur Ulfeldt