From 55e0375851c439c97fc353c61d7c8b2b19485082 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 19 Oct 2017 19:23:10 +0900 Subject: 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. --- jobs/generated/kicking.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'jobs/generated/kicking.cpp') diff --git a/jobs/generated/kicking.cpp b/jobs/generated/kicking.cpp index 2e6797d6..1a544c39 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); +} -- cgit v1.2.3