d3057057763ca31416c9b3afebf2ea03b9d94ba5
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / service-workers / service-worker / resources / test-request-headers-worker.py
1 import json
2 import os
3 import time
4
5 def main(request, response):
6   path = os.path.join(os.path.dirname(__file__),
7                       "test-request-headers-worker.js")
8   body = open(path, "rb").read()
9
10   data = {key:request.headers[key] for key,value in request.headers.iteritems()}
11   body = body.replace("%HEADERS%", json.dumps(data))
12   body = body.replace("%TIMESTAMP%", str(time.time()))
13
14   headers = []
15   headers.append(("ETag", "etag"))
16   headers.append(("Content-Type", 'text/javascript'))
17
18   return headers, body