blob: 9f1568e8166a84aaacba0ca5b71e9c9acd1e647a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
from wptserve.utils import isomorphic_decode
def main(request, response):
headers = [(b"Content-Type", b"application/json"),
(b"Access-Control-Allow-Credentials", b"true")]
if b"origin" in request.headers:
headers.append((b"Access-Control-Allow-Origin", request.headers[b"origin"]))
values = []
for key in request.cookies:
for value in request.cookies.get_list(key):
values.append(u"\"%s\": \"%s\"" % (isomorphic_decode(key), value))
body = u"{ %s }" % u",".join(values)
return headers, body
|