MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / serialize_response

Function serialize_response

app/server/http.cpp:222–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220 return request;
221}
222
223std::string serialize_response(const HttpResponse & response) {
224 std::ostringstream out;
225 out << "HTTP/1.1 " << response.status << " " << status_text(response.status) << "\r\n"
226 << "Content-Type: " << response.content_type << "\r\n"
227 << "Content-Length: " << response.body.size() << "\r\n"
228 << "Connection: close\r\n";
229 for (const auto & [key, value] : response.headers) {
230 out << key << ": " << value << "\r\n";
231 }
232 out << "\r\n";
233 std::string header = out.str();
234 header += response.body;
235 return header;
236}
237
238std::string serialize_stream_headers(const HttpResponse & response) {

Callers 1

handle_clientFunction · 0.85

Calls 3

status_textFunction · 0.85
strMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected