diff --git a/http_examples.cpp b/http_examples.cpp index c9c3683..53aadf8 100644 --- a/http_examples.cpp +++ b/http_examples.cpp @@ -89,11 +89,10 @@ int main() { //Get example simulating heavy work in a separate thread server.resource["^/work$"]["GET"]=[&server](shared_ptr response, shared_ptr /*request*/) { - *response << "HTTP/1.1 200 OK\r\n"; thread work_thread([response] { this_thread::sleep_for(chrono::seconds(5)); string message="Work done"; - *response << "Content-Length: " << message.length() << "\r\n\r\n" << message; + *response << "HTTP/1.1 200 OK\r\nContent-Length: " << message.length() << "\r\n\r\n" << message; }); work_thread.detach(); }; diff --git a/https_examples.cpp b/https_examples.cpp index 016a92e..d41cc16 100644 --- a/https_examples.cpp +++ b/https_examples.cpp @@ -89,11 +89,10 @@ int main() { //Get example simulating heavy work in a separate thread server.resource["^/work$"]["GET"]=[&server](shared_ptr response, shared_ptr /*request*/) { - *response << "HTTP/1.1 200 OK\r\n"; thread work_thread([response] { this_thread::sleep_for(chrono::seconds(5)); string message="Work done"; - *response << "Content-Length: " << message.length() << "\r\n\r\n" << message; + *response << "HTTP/1.1 200 OK\r\nContent-Length: " << message.length() << "\r\n\r\n" << message; }); work_thread.detach(); };