Struct ResponseAttachments
Defined in File typed_router.hpp
Struct Documentation
-
struct ResponseAttachments
Side-channel a handler can attach to its successful response when the default “200 OK + DTO body” is not enough. Examples:
201 Created with a
Locationheader for POST creating a resource.202 Accepted for asynchronously processed requests.
207 Multi-Status for aggregated fan-out responses.
Vendor headers such as
X-Medkit-Local-Only.
Public Functions
-
inline ResponseAttachments &with_status(int status)
Fluent setter for the status override.
-
inline ResponseAttachments &with_header(std::string name, std::string value)
Fluent setter that appends a header entry.
Public Members
-
std::optional<int> status_override
HTTP status to use instead of the default 200. Leave empty for 200.
-
std::vector<std::pair<std::string, std::string>> headers
Additional headers to append. Order is preserved; duplicate names are allowed (cpp-httplib delivers them as separate Set-Cookie-style headers).