summaryrefslogtreecommitdiffstats
path: root/test/wpt/tests/xhr/resources/status.py
blob: 05a59d5a637edde8fb049627fdce8a3a0e836716 (plain)
1
2
3
4
5
6
7
8
9
10
11
from wptserve.utils import isomorphic_encode

def main(request, response):
    code = int(request.GET.first(b"code", 200))
    text = request.GET.first(b"text", b"OMG")
    content = request.GET.first(b"content", b"")
    type = request.GET.first(b"type", b"")
    status = (code, text)
    headers = [(b"Content-Type", type),
               (b"X-Request-Method", isomorphic_encode(request.method))]
    return status, headers, content