chromium/third_party/blink/web_tests/external/wpt/storage-access-api/resources/set-cookie-header.py

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, "")