https://github.com/web-platform-tests/wpt
Raw File
Tip revision: ef54841c892a555e99d0304a8924c77d2f5e4d5a authored by Simon Pieters on 05 June 2018, 08:49:15 UTC
HTML: fix joint session history test to not time out
Tip revision: ef54841
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