diff options
Diffstat (limited to 'testing/web-platform/tests/xhr/resources/redirect.py')
-rw-r--r-- | testing/web-platform/tests/xhr/resources/redirect.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/testing/web-platform/tests/xhr/resources/redirect.py b/testing/web-platform/tests/xhr/resources/redirect.py new file mode 100644 index 0000000000..3839b635e0 --- /dev/null +++ b/testing/web-platform/tests/xhr/resources/redirect.py @@ -0,0 +1,16 @@ +import time + +from wptserve.utils import isomorphic_encode + +def main(request, response): + code = int(request.GET.first(b"code", 302)) + location = request.GET.first(b"location", isomorphic_encode(request.url_parts.path + u"?followed")) + + if b"delay" in request.GET: + delay = float(request.GET.first(b"delay")) + time.sleep(delay / 1E3) + + if b"followed" in request.GET: + return [(b"Content:Type", b"text/plain")], b"MAGIC HAPPENED" + else: + return (code, b"WEBSRT MARKETING"), [(b"Location", location)], b"TEST" |