blob: 4e708a9d6b5bc5da0a4917764a2af3e1f2db8244 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
def main(request, response):
response.headers.set(b'Cache-Control', b'no-store')
response.headers.set(b'Access-Control-Allow-Origin',
request.headers.get(b'origin'))
headers = b'x-custom-s,x-custom-test,x-custom-u,x-custom-ua,x-custom-v'
if request.method == u'OPTIONS':
response.headers.set(b'Access-Control-Max-Age', b'0')
response.headers.set(b'Access-Control-Allow-Headers', headers)
# Access-Control-Request-Headers should be sorted.
if headers != request.headers.get(b'Access-Control-Request-Headers'):
response.status = 400
else:
if request.headers.get(b'x-custom-s'):
response.content = b'PASS'
else:
response.status = 400
response.content = b'FAIL'
|