summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webtransport/handlers/echo-request-headers.py
blob: 122d6f06019e322befd4f518fc22a55dd5b96142 (plain)
1
2
3
4
5
6
7
8
9
10
11
import json


def session_established(session):
    headers = {}
    for name, value in session.request_headers:
        headers[name.decode('utf-8')] = value.decode('utf-8')

    stream_id = session.create_unidirectional_stream()
    data = json.dumps(headers).encode('utf-8')
    session.send_stream_data(stream_id, data, end_stream=True)