summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/service-workers/service-worker/resources/navigation-redirect-scope1.py
blob: 9b90b146955b86b15e828da7111faefaa25699c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
def main(request, response):
    if b"url" in request.GET:
        headers = [(b"Location", request.GET[b"url"])]
        return 302, headers, b''

    status = 200

    if b"noLocationRedirect" in request.GET:
        status = 302

    return status, [(b"content-type", b"text/html")], b'''
<!DOCTYPE html>
<script>
onmessage = event => {
  window.parent.postMessage(
      {
        id: event.data.id,
        result: location.href
      }, '*');
};
</script>
'''