Has anyone experienced boost::beast::http::request_parser p; p.get().body() to be always empty while I see that request is well formed ? what might be the problem if you have experience with that class?

here .base() is the header part which is printed correctly while body is always empty ...

boost::system::error_code ec;
boost::beast::http::request_parser<boost::beast::http::string_body> p;
std::cout<<std::string(data)<<std::endl;
p.put(boost::asio::buffer(data), ec);
std::cout<<p.get().base()<<std::endl;
std::cout<<p.get().body()<<std::endl;`

parsed string data is the follwing:

POST / HTTP/1.1
Host: 127.0.0.1:8812
User-Agent: curl/7.54.0
Accept: */*
Content-Length: 182
Content-Type: application/x-www-form-urlencoded

{
"to_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0",
"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", 
"amount":100, 
"asset_name":"3230313271756265696a696e67"
}

0 Answers