// GNU Lesser General Public License v3.0 // Copyright (c) 2025 Bart Beumer // // This program is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License v3.0 as published by // the Free Software Foundation. // #pragma once #include #include #include #include namespace bmrshared::web { class response_promise final { public: using response_sender = std::function; using callback_on_response = std::function; response_promise() = delete; explicit response_promise(callback_on_response cbOnResponse); ~response_promise(); template void SendResponse(boost::beast::http::response response) { response_sender responder = [r = std::move(response)](boost::beast::tcp_stream& stream) { boost::beast::http::write(stream, r); }; m_call_on_response(std::move(responder)); } private: callback_on_response m_call_on_response; }; } // namespace bmrshared::web