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;
109 auto it = stash.constBegin();
110 while (it != stash.constEnd()) {
111 const QString &key = it.key();
112 if (d->exposeKeys.contains(key)) {
113 exposedStash.insert(key, it.value());
117 obj = QJsonObject::fromVariantHash(exposedStash);
122 QVariantHash exposedStash;
123 QRegularExpression re = d->exposeRE;
125 auto it = stash.constBegin();
126 while (it != stash.constEnd()) {
127 const QString &key = it.key();
128 if (re.match(key).hasMatch()) {
129 exposedStash.insert(key, it.value());
133 obj = QJsonObject::fromVariantHash(exposedStash);
140 res->
setHeader(
"X-Json"_ba,
"eval(\"(\"+this.transport.responseText+\")\")"_ba);
145 return QJsonDocument(obj).toJson(d->format);
void stash(const QVariantHash &unite)
Response * response() const noexcept