Я пытаюсь сделать http-вызов с помощью boost beast и хочу записать его перед записью в сокет; Я попытался использовать ostringstream, чтобы получить значение запроса, чтобы получить его в печатном журнале, и получил следующее сообщение об ошибке:
string verb = "POST";
using http::field;
http::request<http::string_body> request;
request.method_string(verb);
request.target(server_endpoint);
request.version(11);
request.set(field::host, hostname);
request.set(field::accept, "*/*");
request.set(field::authorization, authorization_token);
request.set(field::user_agent, client_name);
request.set(field::content_length, req_str.length());
request.set(field::content_type, "application/x-www-form-urlencoded");
request.set(field::connection, field::close);
request.body() = req_str;
request.prepare_payload();
fast_ostringstream oss;
oss <<"Request message" << request;
PBLOG_INFO(oss.str());
oss.clear();
HttpTracRequestHandler.cpp:78:26: error: invalid operands to binary expression ('framework::string_::fast_ostringstream' and
'http::request<http::string_body>' (aka 'boost::beast::http::message<true, boost::beast::http::basic_string_body<char,
std::char_traits<char>, std::allocator<char> >, boost::beast::http::basic_fields<std::allocator<char> > >'))
oss <<"Request message" << request;
~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~
/BARXPBViewstore/GIT_Workspace/barx_rel/mq8_barx/barx-server/appl/include/FoxException/GenericException.h:133:19: note: candidate function
[with TData = boost::beast::http::message<true, boost::beast::http::basic_string_body<char, std::char_traits<char>,
std::allocator<char> >, boost::beast::http::basic_fields<std::allocator<char> > >] not viable: no known conversion from
'framework::string_::fast_ostringstream' to 'GenericException &' for 1st argument
GenericException& operator<<(GenericException &e, const TData& data)
^
/BARXPBViewstore/GIT_Workspace/boost/boost_1_70_0/boost/beast/http/impl/write.hpp:921:1: note: candidate function [with isRequest = true,
Body = boost::beast::http::basic_string_body<char, std::char_traits<char>, std::allocator<char> >, Fields =
boost::beast::http::basic_fields<std::allocator<char> >] not viable: no known conversion from 'framework::string_::fast_ostringstream'
to 'std::ostream &' (aka 'basic_ostream<char> &') for 1st argument
operator<<(std::ostream& os,
^
/BARXPBViewstore/GIT_Workspace/boost/boost_1_70_0/boost/beast/http/write.hpp:721:1: note: candidate function [with isRequest = true, Fields
= boost::beast::http::basic_fields<std::allocator<char> >] not viable: no known conversion from
'framework::string_::fast_ostringstream' to 'std::ostream &' (aka 'basic_ostream<char> &') for 1st argument
operator<<(std::ostream& os,
^
/BARXPBViewstore/GIT_Workspace/boost/boost_1_70_0/boost/beast/http/impl/write.hpp:901:1: note: candidate function [with Fields =
boost::beast::http::basic_fields<std::allocator<char> >] not viable: no known conversion from 'framework::string_::fast_ostringstream'
to 'std::ostream &' (aka 'basic_ostream<char> &') for 1st argument