summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/module/dynamic-import/resources/status-changing-script.py
blob: a44d3dd3eb0c0294f276d26ba319179ec5e9a2ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
def main(request, response):
    headers = [(b"Content-Type", b"text/javascript"),
               (b"Cache-Control", b"private, no-store")]

    id = request.GET.first(b"id")

    with request.server.stash.lock:
        status = request.server.stash.take(id)
        if status is None:
            status = 200

        new_status = request.GET.first(b"newStatus", None)
        if new_status is not None:
            status = int(new_status)

        request.server.stash.put(id, status)

        return status, headers, b""