* Decode message, enforce a Dictionary * * @param message JSON string * * @return Dictionary ptr */
| 146 | * @return Dictionary ptr |
| 147 | */ |
| 148 | Dictionary::Ptr JsonRpc::DecodeMessage(const String& message) |
| 149 | { |
| 150 | // Use something a bit higher than the default limit to accommodate for data that was accepted by Icinga 2 elsewhere |
| 151 | // and gained some additional nesting levels when being wrapped in a JSON-RPC message. |
| 152 | Value value = JsonDecode(message, JsonDecodeDefaultDepthLimit + 8); |
| 153 | |
| 154 | if (!value.IsObjectType<Dictionary>()) { |
| 155 | BOOST_THROW_EXCEPTION(std::invalid_argument("JSON-RPC" |
| 156 | " message must be a dictionary.")); |
| 157 | } |
| 158 | |
| 159 | return value; |
| 160 | } |
nothing calls this directly
no outgoing calls
no test coverage detected