blob: 612add2169385fe5bd17ed981c973b0419a36e18 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
from cookies.resources.helpers import makeDropCookie, readParameter, setNoCacheAndCORSHeaders
def main(request, response):
"""Respond to `/cookie/drop?name={name}` by expiring the cookie named `{name}`."""
headers = setNoCacheAndCORSHeaders(request, response)
try:
# Expire the named cookie, and return a JSON-encoded success code.
name = readParameter(request, paramName=u"name", requireValue=True)
scheme = request.url_parts.scheme
headers.append(makeDropCookie(name, u"https" == scheme))
return headers, b'{"success": true}'
except:
return 500, headers, b'{"error" : "Empty or missing name parameter."}'
|