summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webtransport/handlers/custom-response.py
blob: 05e4c4ba368c1cb02c89f1953b42481388d06c18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from urllib.parse import urlsplit, parse_qsl


def connect_received(request_headers, response_headers):
    for data in request_headers:
        if data[0] == b':path':
            path = data[1].decode('utf-8')

            qs = dict(parse_qsl(urlsplit(path).query))
            for key, value in qs.items():
                response_headers.append((key.encode('utf-8'), value.encode('utf-8')))

            break
    return