summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/storage-access-api/resources/set-cookie-header.py
blob: e937ba2ca4eca2421ea0025c5a527d3bb6b574f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
from urllib.parse import unquote
from wptserve.utils import isomorphic_encode

def main(request, response):
  # Cookies may require whitespace (e.g. in the `Expires` attribute), so the
  # query string should be decoded.
  cookie = unquote(request.url_parts.query)
  headers = []
  headers.append((b"Set-Cookie", isomorphic_encode(cookie)))

  return (200, headers, "")