| 13 | using namespace icinga; |
| 14 | |
| 15 | Dictionary::Ptr HttpUtility::FetchRequestParameters(const Url::Ptr& url, const std::string& body) |
| 16 | { |
| 17 | Dictionary::Ptr result; |
| 18 | |
| 19 | if (!body.empty()) { |
| 20 | Log(LogDebug, "HttpUtility") |
| 21 | << "Request body: '" << body << '\''; |
| 22 | |
| 23 | result = JsonDecode(body); |
| 24 | } |
| 25 | |
| 26 | if (!result) |
| 27 | result = new Dictionary(); |
| 28 | |
| 29 | std::map<String, std::vector<String>> query; |
| 30 | for (const auto& kv : url->GetQuery()) { |
| 31 | query[kv.first].emplace_back(kv.second); |
| 32 | } |
| 33 | |
| 34 | for (auto& kv : query) { |
| 35 | result->Set(kv.first, Array::FromVector(kv.second)); |
| 36 | } |
| 37 | |
| 38 | return result; |
| 39 | } |
| 40 | |
| 41 | Value HttpUtility::GetLastParameter(const Dictionary::Ptr& params, const String& key) |
| 42 | { |