REGRESSION: [ Mac wk2 ] imported/w3c/web-platform-tests/service-workers/service-worke...
[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 uuid
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("%UUID%", str(uuid.uuid4()))
13
14   headers = []
15   headers.append(("ETag", "etag"))
16   headers.append(("Content-Type", 'text/javascript'))
17
18   return headers, body