#include <http_server.h>
◆ HttpResponse()
| uvco::examples::HttpResponse::HttpResponse |
( |
| ) |
|
std::vector< std::pair< std::string_view, std::string > > headers
Definition http_server.h:34
◆ toString()
| std::string uvco::examples::HttpResponse::toString |
( |
| ) |
|
23 {
24 headers.emplace_back(
"Content-Length", std::to_string(
body.length()));
25 fmt::memory_buffer buf;
26 fmt::format_to(std::back_inserter(buf),
"HTTP/1.1 {} {}\r\n",
statusCode,
28 for (
const auto &header :
headers) {
29 fmt::format_to(std::back_inserter(buf), "{}: {}\r\n", header.first,
30 header.second);
31 }
32 fmt::format_to(std::back_inserter(buf), "\r\n");
33 fmt::format_to(std::back_inserter(buf),
"{}",
body);
34 return fmt::to_string(buf);
35}
std::string statusMessage
Definition http_server.h:33
std::string body
Definition http_server.h:35
int statusCode
Definition http_server.h:32
◆ body
| std::string uvco::examples::HttpResponse::body |
◆ headers
| std::vector<std::pair<std::string_view, std::string> > uvco::examples::HttpResponse::headers |
◆ statusCode
| int uvco::examples::HttpResponse::statusCode = 200 |
◆ statusMessage
| std::string uvco::examples::HttpResponse::statusMessage = "OK" |
The documentation for this struct was generated from the following files: