| 180 | }; |
| 181 | |
| 182 | inline bool parseMessage(const QByteArray& data, QString& type, QJsonObject& json) |
| 183 | { |
| 184 | QJsonParseError error; |
| 185 | const auto doc = QJsonDocument::fromJson(data, &error); |
| 186 | |
| 187 | if (error.error != QJsonParseError::NoError) |
| 188 | return false; |
| 189 | |
| 190 | if (!doc.isObject()) |
| 191 | return false; |
| 192 | |
| 193 | json = doc.object(); |
| 194 | type = json.value(QStringLiteral("type")).toString(); |
| 195 | |
| 196 | return !type.isEmpty(); |
| 197 | } |
| 198 | |
| 199 | inline bool isApiMessage(const QByteArray& data) |
| 200 | { |
no test coverage detected