summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/service-workers/service-worker/resources/bytecheck-worker-imported-script.py
blob: 1931c77b6780b35c510d77a760ad4f1a9a87b28c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import time

def main(request, response):
    headers = [(b'Content-Type', b'application/javascript'),
               (b'Cache-Control', b'max-age=0'),
               (b'Access-Control-Allow-Origin', b'*')]

    imported_content_type = b''
    if b'imported' in request.GET:
        imported_content_type = request.GET[b'imported']

    imported_content = b'default'
    if imported_content_type == b'time':
        imported_content = b'%f' % time.time()

    body = b'''
    // %s
    ''' % (imported_content)

    return headers, body