#pragma once #include #include #include #include #include /** Somehow, in case of POST, Poco::Net::HTMLForm doesn't read parameters from URL, only from body. * This helper allows to read parameters just from URL. */ struct HTMLForm : public Poco::Net::HTMLForm { HTMLForm(const Poco::Net::HTTPRequest & request) { Poco::URI uri(request.getURI()); std::istringstream istr(uri.getRawQuery()); // STYLE_CHECK_ALLOW_STD_STRING_STREAM readUrl(istr); } HTMLForm(const Poco::URI & uri) { std::istringstream istr(uri.getRawQuery()); // STYLE_CHECK_ALLOW_STD_STRING_STREAM readUrl(istr); } template T getParsed(const std::string & key, T default_value) { auto it = find(key); return (it != end()) ? DB::parse(it->second) : default_value; } template T getParsed(const std::string & key) { return DB::parse(get(key)); } };