http.transport ============== .. py:module:: http.transport .. autoapi-nested-parse:: HTTP transport helpers for the webapp request handler. These utilities centralize UTF-8 response writing and JSON body parsing so the request handler can focus on route dispatch and endpoint behavior. Functions --------- .. autoapisummary:: http.transport.send_text http.transport.send_bytes http.transport.send_json http.transport.read_json_body Module Contents --------------- .. py:function:: send_text(handler, content, *, status = 200, content_type = 'text/plain') Write a UTF-8 text response through a ``BaseHTTPRequestHandler``-like object. .. py:function:: send_bytes(handler, payload, *, status = 200, content_type = 'application/octet-stream') Write raw binary data through a ``BaseHTTPRequestHandler``-like object. .. py:function:: send_json(handler, payload, *, status = 200) Serialize and write a JSON object response. .. py:function:: read_json_body(handler) Read and validate a JSON object request body from the handler stream.