summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/echo-client-hints-received.py
blob: 3c613306713c7d1941ee782e4992b8925900f119 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
def main(request, response):
    """
    Simple handler that sets a response header based on which client hint
    request headers were received.
    """

    response.headers.append(b"Access-Control-Allow-Origin", b"*")
    response.headers.append(b"Access-Control-Allow-Headers", b"*")
    response.headers.append(b"Access-Control-Expose-Headers", b"*")

    if b"sec-ch-device-memory" in request.headers:
            response.headers.set(b"device-memory-received", request.headers.get(b"sec-ch-device-memory"))
    if b"device-memory" in request.headers:
            response.headers.set(b"device-memory-deprecated-received", request.headers.get(b"device-memory"))