blob: e388e461448f64d37d747b26830f4e869a2c6528 [file] [log] [blame]
# This serves the worker JavaScript file. It takes a |greeting| request
# parameter to inject into the JavaScript to indicate how the request
# reached the server.
import os
import sys
def main(request, response):
path = os.path.join(os.path.dirname(__file__),
"worker-interception-redirect-webworker.js")
body = open(path, "rb").read()
if "greeting" in request.GET:
body = body.replace("%GREETING_TEXT%", request.GET["greeting"])
else:
body = body.replace("%GREETING_TEXT%", "")
headers = []
headers.append(("Content-Type", "text/javascript"))
return headers, body