summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/loading/early-hints/resources/invalid-headers-in-early-hints.h2.py
blob: 438d1c79accddbe568dc1245acd6e0a3c425c64e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import os


def handle_headers(frame, request, response):
    header_value = request.GET.first(b"header-value")
    early_hints = [
        (b":status", b"103"),
        (b"invalid-header", header_value),
    ]
    response.writer.write_raw_header_frame(headers=early_hints,
                                           end_headers=True)

    response.status = 200
    response.headers[b"content-type"] = "text/html"
    response.write_status_headers()


def main(request, response):
    test_content = "<div>This page should not be loaded.</div>"
    response.writer.write_data(item=test_content, last=True)