what can cause an error -1002

Hi,

I implementing a c++ wrapper to the api using boost::beast, and I have issues with the POSTs.
(GETs works fine)

I got {“code”:-1002,“msg”:“You are not authorized to execute this request.”} which i really do not understand. When I perform the same POST from the same machine using cUrl everything is fine.

Anyone have an idea from where it can come?
Thanks,
Trog

SOLVED:

The issue is really the order of the creation of the request! I did not realised it before, one really have to do it that order:

http::request< http::string_body> req{http::verb::post, target, version};
req.set(http::field::host, host);
req.set(http::field::user_agent, “BOOST_BEAST_VERSION_STRING”);
req.set(“X-MBX-APIKEY”,api_key);
req.body() = str_request;
req.set(http::field::content_type, “application/x-www-form-urlencoded”);
req.set(http::field::content_length, std::to_string(str_request.size()) );
req.prepare_payload();

1 Like