summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/forms/form-submission-0/resources/form-submission.py
blob: f0c2d4cf61fed10f8854fc9b3d93d7099199a655 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
def main(request, response):
    if request.headers.get(b'Content-Type') == b'application/x-www-form-urlencoded':
        result = request.body == b'foo=bara'
    elif request.headers.get(b'Content-Type') == b'text/plain':
        result = request.body == b'qux=baz\r\n'
    else:
        result = request.POST.first(b'foo') == b'bar'

    result = result and request.url_parts.query == u'query=1'

    return ([(b"Content-Type", b"text/plain")],
            b"OK" if result else b"FAIL")