samedi 14 mai 2022

BOOST request sending JSON data

I want to transfer json data into request of json boost in cpp.

If i take json in boost

int outer=2;

value data = {
        {"dia",outer},
        {"sleep_time_in_s",0.1}
    };

request.body()=data;

like above i want to send data from boost client to server , but it's through error is any one understand below error suggest me .

error C2679: binary '=': no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)

C:\Boost\boost/beast/core/multi_buffer.hpp(360,25): message : could be 'boost::beast::basic_multi_buffer<std::allocator<char>> &boost::beast::basic_multi_buffer<std::allocator<char>>::operator =(const boost::beast::basic_multi_buffer<std::allocator<char>> &)'

2>C:\Boost\boost/beast/core/multi_buffer.hpp(345,5): message : or       'boost::beast::basic_multi_buffer<std::allocator<char>> &boost::beast::basic_multi_buffer<std::allocator<char>>::operator =(boost::beast::basic_multi_buffer<std::allocator<char>> &&)'

2>C:\Development\qa-cal\sysqa_cpp\src\guiClient\boostHttpClient.cpp(90,31): message : while trying to match the argument list '(boost::beast::basic_multi_buffer<std::allocator<char>>, std::string)'

Aucun commentaire:

Enregistrer un commentaire