Revision bc209c37228e5071e3fc8d3bcbc78c7b09db57a8 authored by Kent Tamura on 02 April 2018, 08:48:54 UTC, committed by Blink WPT Bot on 02 April 2018, 08:59:11 UTC
Bug: 821831
Change-Id: I5b3e1978e37ce34e6fb885ca1077ea90ab2f494c
Reviewed-on: https://chromium-review.googlesource.com/987972
Reviewed-by: Takayoshi Kochi <kochi@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547424}
1 parent 94b33b5
Raw File
redirect-opt-in.py
def main(request, response):
    """Simple handler that causes redirection.

    The request should typically have two query parameters:
    status - The status to use for the redirection. Defaults to 302.
    location - The resource to redirect to.
    """
    status = 302
    if "status" in request.GET:
        try:
            status = int(request.GET.first("status"))
        except ValueError:
            pass

    response.status = status

    location = request.GET.first("location")

    response.headers.set("Location", location)
    response.headers.set("Timing-Allow-Origin", "*")
back to top