MCPcopy Create free account
hub / github.com/Icinga/icinga2 / FetchRequestParameters

Method FetchRequestParameters

lib/remote/httputility.cpp:15–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13using namespace icinga;
14
15Dictionary::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
41Value HttpUtility::GetLastParameter(const Dictionary::Ptr& params, const String& key)
42{

Callers

nothing calls this directly

Calls 3

LogClass · 0.85
emptyMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected