Struct BinaryResponse
Defined in File response_types.hpp
Struct Documentation
-
struct BinaryResponse
Response shape returned by
RouteRegistry::binary_downloadhandlers. The framework wires theprovidercallback into cpp-httplib’s range-aware content provider machinery. Range support is opt-in viasupports_rangesbecause not every backend can serve byte ranges efficiently.Minimum viable shape - real-world callers (bulkdata, snapshot download) will tune the contract in their migration commit.
Public Members
-
std::function<bool(uint64_t offset, uint64_t length, httplib::DataSink &sink)> provider
Range-aware content provider.
offsetandlengthare byte offsets into the logical resource; the callback writes the requested slice intosinkand returnstrueto continue orfalseto abort the stream.
-
std::string content_type
MIME type (e.g.
application/octet-stream,application/gzip).
-
std::optional<std::string> filename
Optional download filename; rendered as
Content-Dispositionif set.
-
bool supports_ranges = {false}
True iff the provider honours
offset/length. False -> framework serves the full body in one shot.
-
uint64_t total_size = {0}
Total size in bytes; cpp-httplib uses this for
Content-Length.
-
std::function<bool(uint64_t offset, uint64_t length, httplib::DataSink &sink)> provider