91 const QVariantHash stash = c->
stash();
93 switch (d->exposeMode) {
95 obj = QJsonObject::fromVariantHash(stash);
99 auto it = stash.constFind(d->exposeKey);
100 if (it != stash.constEnd()) {
101 obj.insert(d->exposeKey, QJsonValue::fromVariant(it.value()));
107 QVariantHash exposedStash;
108 for (
const auto &[key, value] : stash.asKeyValueRange()) {
109 if (d->exposeKeys.contains(key)) {
110 exposedStash.insert(key, value);
114 obj = QJsonObject::fromVariantHash(exposedStash);
119 QRegularExpression re = d->exposeRE;
121 QVariantHash exposedStash;
122 for (
const auto &[key, value] : stash.asKeyValueRange()) {
123 if (re.match(key).hasMatch()) {
124 exposedStash.insert(key, value);
128 obj = QJsonObject::fromVariantHash(exposedStash);
135 res->
setHeader(
"X-Json"_ba,
"eval(\"(\"+this.transport.responseText+\")\")"_ba);
140 return QJsonDocument(obj).toJson(d->format);
void stash(const QVariantHash &unite)
Response * response() const noexcept