Skip to main content

Module response

Module response 

Source
Expand description

HTTP responses: Response, its writers and the upstream-response parser.

A response has a status, headers and a body as a list of ContentRanges (one, or several for a multipart/byteranges range response), or a stream_file / stream_pipe for bodies too large to buffer. Response::json / Response::text build the common cases. The writers (generate_response, generate_response_parts, …) add Content-Type, Content-Length and Content-Range; Response::parse reads a raw upstream response (used by the proxy). Examples: src/response/example/.

Structs§

Error
Response
An HTTP response. Build one inside [Controller::process] and return it.
ResponseStatusCodeReasonPhrase
StatusCodeReasonPhrase

Constants§

STATUS_CODE_REASON_PHRASE

Functions§

content_range_header_value
The Content-Range value for a single-part body, or None when the response shouldn’t carry one. RFC 9110 §14.4 gives Content-Range meaning only on 206 Partial Content (and 416, which rws answers with a plain error body), so full 200 responses get no such header. range.end is inclusive.