mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
CIParser: Make property headers human-readable in getMessageDescription
This commit is contained in:
parent
9a55eb852a
commit
0192c86715
1 changed files with 23 additions and 1 deletions
|
|
@ -162,7 +162,29 @@ private:
|
|||
{
|
||||
const auto opts = ToVarOptions{}.withExplicitVersion ((int) msg->header.version)
|
||||
.withVersionIncluded (false);
|
||||
const auto json = ToVar::convert (body, opts);
|
||||
auto json = ToVar::convert (body, opts);
|
||||
|
||||
if (auto* obj = json->getDynamicObject(); obj != nullptr && obj->hasProperty ("header"))
|
||||
{
|
||||
const auto header = obj->getProperty ("header");
|
||||
const auto bytes = [&]() -> std::vector<std::byte>
|
||||
{
|
||||
const auto* arr = header.getArray();
|
||||
|
||||
if (arr == nullptr)
|
||||
return {};
|
||||
|
||||
std::vector<std::byte> vec;
|
||||
vec.reserve ((size_t) arr->size());
|
||||
|
||||
for (const auto& i : *arr)
|
||||
vec.push_back ((std::byte) (int) i);
|
||||
|
||||
return vec;
|
||||
}();
|
||||
|
||||
obj->setProperty ("header", Encodings::jsonFrom7BitText (bytes));
|
||||
}
|
||||
|
||||
if (json.has_value())
|
||||
*result = String (getDescription (body)) + ": " + JSON::toString (*json, JSON::FormatOptions{}.withSpacing (JSON::Spacing::none));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue