summaryrefslogtreecommitdiffstats
path: root/test/wpt/tests/xhr/resources/access-control-preflight-request-headers-origin.py
blob: b8fb22050aa367f424e24864e1544307b20ffef2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
def main(request, response):
    response.headers.set(b"Cache-Control", b"no-store")
    response.headers.set(b"Access-Control-Allow-Origin", b"*")

    if request.method == u"OPTIONS":
        if b"origin" in request.headers.get(b"Access-Control-Request-Headers").lower():
            response.status = 400
            response.content = b"Error: 'origin' included in Access-Control-Request-Headers"
        else:
            response.headers.set(b"Access-Control-Allow-Headers", b"x-pass")
    else:
        response.content = request.headers.get(b"x-pass")