summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fetch/metadata/resources/echo-as-script.py
blob: 1e7bc91184fdd6de9fdf9982146e009211737c9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import json

from wptserve.utils import isomorphic_decode

def main(request, response):
    headers = [(b"Content-Type", b"text/javascript")]
    body = u"var header = %s;" % json.dumps({
        u"dest": isomorphic_decode(request.headers.get(b"sec-fetch-dest", b"")),
        u"mode": isomorphic_decode(request.headers.get(b"sec-fetch-mode", b"")),
        u"site": isomorphic_decode(request.headers.get(b"sec-fetch-site", b"")),
        u"user": isomorphic_decode(request.headers.get(b"sec-fetch-user", b"")),
        })

    return headers, body