From 5bcc5098084cb1c10823d1e650c105d5dde37d85 Mon Sep 17 00:00:00 2001 From: kamathmanu <manuriddle@gmail.com> Date: Mon, 4 Jan 2021 15:03:27 -0500 Subject: [PATCH] Fix bugs and pass JSON tests for requests --- lib/structs/requests.cpp | 2 +- tests/requests.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/structs/requests.cpp b/lib/structs/requests.cpp index 6ab180e81..d53ad8576 100644 --- a/lib/structs/requests.cpp +++ b/lib/structs/requests.cpp @@ -137,7 +137,7 @@ to_json(json &obj, const PublicRooms &request) throw std::invalid_argument("third_party_instance_id id can only be set if include_all_networks is false"); } obj["third_party_instance_id"] = request.third_party_instance_id; - obj["include_all_networks"] = !request.third_party_instance_id.empty(); + obj["include_all_networks"] = request.third_party_instance_id.empty(); } void diff --git a/tests/requests.cpp b/tests/requests.cpp index dd6d4eecc..068660236 100644 --- a/tests/requests.cpp +++ b/tests/requests.cpp @@ -314,6 +314,7 @@ TEST(Requests, PublicRooms) "generic_search_term" : "foo" }, "include_all_networks" : false, + "since" : "", "third_party_instance_id" : "irc" })"_json); @@ -325,6 +326,8 @@ TEST(Requests, PublicRooms) EXPECT_EQ(j, R"({ "limit" : 10, "include_all_networks" : false, + "since": "", + "filter": {"generic_search_term":""}, "third_party_instance_id" : "matrix" })"_json); -- GitLab