Skip to content

Commit

Permalink
Merge 3bec646 into 7331d5d
Browse files Browse the repository at this point in the history
  • Loading branch information
Freezerburn committed Jul 11, 2015
2 parents 7331d5d + 3bec646 commit d75d84c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions falcon/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,16 @@ def set_cookie(self, name, value, expires=None, max_age=None,
def unset_cookie(self, name):
"""Unset a cookie from the response
"""
if self._cookies is not None and name in self._cookies:
del self._cookies[name]
if self._cookies is None:
self._cookies = SimpleCookie()
if name not in self._cookies:
self._cookies[name] = ""
# SimpleCookie apparently special cases the expires attribute to
# automatically use strftime and set the time as a delta from the
# current time. We use -1 here to basically tell the browser to
# immediately expire the cookie, thus removing it from future
# request objects.
self._cookies[name]["expires"] = -1

def set_header(self, name, value):
"""Set a header for this response to a given value.
Expand Down

0 comments on commit d75d84c

Please sign in to comment.