Open Vermeille opened 7 years ago
This has been discussed, along with code examples, here: https://github.com/ipkn/crow/issues/170
In my project, I use it as in the following example:
CROW_ROUTE(app, "/myoutputs").methods("POST"_method)
([&](const crow::request& req) {
map<std::string, std::string> post_body
= xmreg::parse_crow_post_data(req.body);
if (post_body.count("xmr_address") == 0
|| post_body.count("viewkey") == 0
|| post_body.count("tx_hash") == 0)
{
return string("xmr address, viewkey or tx hash not provided");
}
string tx_hash = post_body["tx_hash"];
string xmr_address = post_body["xmr_address"];
string viewkey = post_body["viewkey"];
// this will be only not empty when checking raw tx data
// using tx pusher
string raw_tx_data = post_body["raw_tx_data"];
return xmrblocks.show_my_outputs(tx_hash, xmr_address,
viewkey, raw_tx_data);
});
https://github.com/moneroexamples/onion-monero-blockchain-explorer/blob/master/main.cpp#L201
Nice, thanks :)
Should it be contributed back in Crow, with POST data automatically parsed in the request and stored in the request object? IMHO it should, but it's up to the maintainer :)
Crow hasn't seen a single commit in about a year. It seems as it development stopped for now.
Hi!
I've been using Crow for a few days now, and it's missing being able to read POST data, like you get from a form.
I'm more than willing to contribute to this, but would like to discuss the best way to implement this. Should we move request.url_parans to requets.params that will contain both GET and POST params? Does that makes the server vulnerable to CSRF? Should we add request.body_params?
Thanks :)