96 const QVariantHash stash = c->
stash();
98 switch (d->exposeMode) {
100 obj = QJsonObject::fromVariantHash(stash);
104 auto it = stash.constFind(d->exposeKey);
105 if (it != stash.constEnd()) {
106 obj.insert(d->exposeKey, QJsonValue::fromVariant(it.value()));
112 QVariantHash exposedStash;
114 auto it = stash.constBegin();
115 while (it != stash.constEnd()) {
116 const QString &key = it.key();
117 if (d->exposeKeys.contains(key)) {
118 exposedStash.insert(key, it.value());
122 obj = QJsonObject::fromVariantHash(exposedStash);
125 case RegularExpression:
127 QVariantHash exposedStash;
128 QRegularExpression re = d->exposeRE;
130 auto it = stash.constBegin();
131 while (it != stash.constEnd()) {
132 const QString &key = it.key();
133 if (re.match(key).hasMatch()) {
134 exposedStash.insert(key, it.value());
138 obj = QJsonObject::fromVariantHash(exposedStash);
144 if (d->xJsonHeader && c->request()->
headers().
contains(QStringLiteral(
"X_PROTOTYPE_VERSION"))) {
146 QStringLiteral(
"eval(\"(\"+this.transport.responseText+\")\")"));
151 return QJsonDocument(obj).toJson(d->format);
void stash(const QVariantHash &unite)
Response * response() const noexcept