userver: userver/server/http/http_response_body_stream.hpp Source File
Loading...
Searching...
No Matches
http_response_body_stream.hpp
Go to the documentation of this file.
1#pragma once
2
5
6#include <string>
7
10
11USERVER_NAMESPACE_BEGIN
12
13namespace server::http {
14
19class ResponseBodyStream final {
20public:
22 explicit ResponseBodyStream(HttpResponse& http_response);
23
26
29 void PushBodyChunk(std::string&& chunk, engine::Deadline deadline);
30
32 void SetBody(std::string&& body);
33
34 void SetHeader(const std::string&, const std::string&);
35
36 void SetHeader(std::string_view, const std::string&);
37
38 void SetEndOfHeaders();
39
41 void SetStatusCode(int status_code);
42
45
46private:
47 struct BodyProducer;
48
49 bool headers_ended_{false};
50 bool headers_end_sent_{false};
52 HttpResponse& http_response_;
53};
54
55} // namespace server::http
56
57USERVER_NAMESPACE_END