https://github.com/web-platform-tests/wpt
Raw File
Tip revision: b84de1af3975474085aea3b9b1656a7460200d31 authored by Simon Pieters on 11 April 2017, 20:50:51 UTC
Rename tests to be more descriptive
Tip revision: b84de1a
cors-cookie.py

def main(request, response):
    origin = request.GET.first("origin", request.headers["origin"])
    credentials = request.GET.first("credentials", "true")

    headers = [("Content-Type", "text/plain")]
    if origin != 'none':
        headers.append(("Access-Control-Allow-Origin", origin))
    if credentials != 'none':
        headers.append(("Access-Control-Allow-Credentials", credentials))

    ident = request.GET.first('ident', 'test')

    if ident in request.cookies:
        body = request.cookies[ident].value
        response.delete_cookie(ident)
    else:
        response.set_cookie(ident, "COOKIE");
        body = "NO_COOKIE"

    return headers, body
back to top