microsoft / cpprestsdk

The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Other
7.96k stars 1.65k forks source link

http_listener duplicate get calls #1656

Open Rakeki opened 2 years ago

Rakeki commented 2 years ago

std::unique_ptr m_listener;

void Host() { m_listener = std::make_unique("http://192.168.1.237:8080"); m_listener->support(methods::GET, WebServer::Get_Client); m_listener->open().wait(); }

// for every http call, Get_Client gets called twice static void Get_Client(http_request request) { Instance i(10,20201); if(i.CreateDirectory()) { request.reply(status_codes::OK, "Created"); } else { request.reply(status_codes::OK, "Error"); } }