summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/mozilla/tests/service-workers/resources/fetch_video.py
blob: 3945506f303771373a4c0f6f14e105a2b46d022d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import os


def main(request, response):
    filename = os.path.join(request.doc_root, "media", "2x2-green.ogv")
    body = open(filename, "rb").read()
    length = len(body)
    headers = [
        (b"Content-Type", b"video/ogg"),
        (b"Accept-Ranges", b"bytes"),
        (b"Content-Length", b"%d" % length),
        (b"Content-Range", b"bytes 0-%d/%d" % (length - 1, length)),
    ]
    return headers, body