mirror of
https://github.com/servo/servo.git
synced 2025-07-11 17:33:47 +01:00
13 lines
472 B
Python
13 lines
472 B
Python
import helpers
|
|
import urllib
|
|
|
|
def main(request, response):
|
|
"""Respond to `/cookie/set?{cookie}` by echoing `{cookie}` as a `Set-Cookie` header."""
|
|
headers = helpers.setNoCacheAndCORSHeaders(request, response)
|
|
|
|
# Cookies may require whitespace (e.g. in the `Expires` attribute), so the
|
|
# query string should be decoded.
|
|
cookie = urllib.unquote(request.url_parts.query)
|
|
headers.append(("Set-Cookie", cookie))
|
|
|
|
return headers, '{"success": true}'
|