aboutsummaryrefslogtreecommitdiff
path: root/jobs/generated/kicking.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-10-19 19:23:10 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-12-07 12:30:37 +0900
commite88627976488b0b6eea6da3389eefb860980d661 (patch)
treec5972d761fc43b6a29b86a495722d309ccf80b65 /jobs/generated/kicking.cpp
parent70d9ca7b870e35109dfdbe9ab3c63ba094a75379 (diff)
downloadlibquotient-e88627976488b0b6eea6da3389eefb860980d661.tar.gz
libquotient-e88627976488b0b6eea6da3389eefb860980d661.zip
Generated jobs: Don't dump empty strings to body parameters
This is important for (soon to be added) LoginJob, since the server is sensitive to getting an (even empty) entity for "medium" as opposed to omitting it entirely. This cannot be addressed on the spec level; on the other hand, removing empty parameters from the payload reduces useless bytes getting on the wire.
Diffstat (limited to 'jobs/generated/kicking.cpp')
-rw-r--r--jobs/generated/kicking.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/jobs/generated/kicking.cpp b/jobs/generated/kicking.cpp
index e75b900a..28d51d05 100644
--- a/jobs/generated/kicking.cpp
+++ b/jobs/generated/kicking.cpp
@@ -15,11 +15,13 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0");
KickJob::KickJob(QString roomId, QString user_id, QString reason)
: BaseJob(HttpVerb::Post, "KickJob",
basePath % "/rooms/" % roomId % "/kick",
- Query { },
- Data {
- { "user_id", toJson(user_id) },
- { "reason", toJson(reason) }
- }
+ Query { }
)
-{ }
+{
+ Data _data;
+ _data.insert("user_id", toJson(user_id));
+ if (!reason.isEmpty())
+ _data.insert("reason", toJson(reason));
+ setRequestData(_data);
+}