diff --git a/http_examples.cpp b/http_examples.cpp index 8795aff..aa91c4e 100644 --- a/http_examples.cpp +++ b/http_examples.cpp @@ -127,8 +127,7 @@ int main() { server.resource["^/work$"]["GET"]=[](shared_ptr response, shared_ptr /*request*/) { thread work_thread([response] { this_thread::sleep_for(chrono::seconds(5)); - string message="Work done"; - *response << "HTTP/1.1 200 OK\r\nContent-Length: " << message.length() << "\r\n\r\n" << message; + response->write("Work done"); }); work_thread.detach(); }; diff --git a/https_examples.cpp b/https_examples.cpp index 74368dd..6ae6a9a 100644 --- a/https_examples.cpp +++ b/https_examples.cpp @@ -125,8 +125,7 @@ int main() { server.resource["^/work$"]["GET"]=[](shared_ptr response, shared_ptr /*request*/) { thread work_thread([response] { this_thread::sleep_for(chrono::seconds(5)); - string message="Work done"; - *response << "HTTP/1.1 200 OK\r\nContent-Length: " << message.length() << "\r\n\r\n" << message; + response->write("Work done"); }); work_thread.detach(); };