32 virtual void set_header(
const std::string& key,
const std::string& value) = 0;
69 virtual void end() = 0;
77 virtual void send_sse_event(std::string_view data, std::string_view event =
"", std::string_view
id =
"") = 0;
84 virtual void upgrade_to_raw_stream(std::function<
void(std::string_view)> on_data, std::function<
void()> on_close) = 0;
91 virtual void read_body_stream(std::function<
void(std::string_view)> on_data, std::function<
void()> on_end) = 0;
Definition ThreadPool.hpp:12
Represents an HTTP response to be sent to a client.
Definition HttpResponse.hpp:50
Abstract interface for writing HTTP responses.
Definition ResponseWriter.hpp:16
virtual void add_interceptor(Interceptor interceptor)=0
Adds an interceptor to modify the response before it is sent.
virtual void set_header(const std::string &key, const std::string &value)=0
Adds a default header that will be included in the final response.
virtual void upgrade_to_raw_stream(std::function< void(std::string_view)> on_data, std::function< void()> on_close)=0
Upgrades the connection to a raw bi-directional byte stream.
virtual void send_headers(HttpResponse &response)=0
Sends only the HTTP headers.
virtual void end()=0
Ends a chunked response stream.
virtual network::Proactor & proactor()=0
Gets the underlying Proactor to dispatch async operations.
virtual void read_body_stream(std::function< void(std::string_view)> on_data, std::function< void()> on_end)=0
Asynchronously streams the incoming HTTP request body.
virtual ~ResponseWriter()=default
virtual void write_chunk(std::string_view chunk)=0
Streams a chunk of data (for Chunked Transfer Encoding).
virtual void send(HttpResponse &&response)=0
Sends a complete HTTP response.
virtual void send_sse_event(std::string_view data, std::string_view event="", std::string_view id="")=0
Sends a Server-Sent Events (SSE) message.
std::function< void(HttpResponse &)> Interceptor
Definition ResponseWriter.hpp:20
virtual concurrency::ThreadPool & thread_pool()=0
Gets the thread pool to offload blocking tasks.
Definition Proactor.hpp:8
Definition Http2Session.hpp:21
Definition ResponseWriter.hpp:7