fix(dispatch): answer the login a/b test list

This commit is contained in:
capyb2222 committed 2026-09-12 22:01:22 -07:00
1 parent 9536151543
commit 58a82b61e8
2 files changed
+17

No files matched your search

+12
View File
@@ -239,6 +239,18 @@ void registerRoutes(http::Server& server) {
}); });
// ---- srtools ---- // ---- srtools ----
// The login SDK throws in its callback on the generic stub, which has no data list.
server.any("/data_abtest_api/config/experiment/list", [](const http::Request&, http::Response& res) {
json experiment{{"code", 1000},
{"type", 2},
{"config_id", "14"},
{"period_id", "6125_197"},
{"version", "1"},
{"configs", json{{"cardType", "direct"}}}};
res.json(json{{"retcode", 0}, {"success", true}, {"message", ""}, {"data", json::array({experiment})}}
.dump());
});
server.post("/srtools", [](const http::Request& req, http::Response& res) { server.post("/srtools", [](const http::Request& req, http::Response& res) {
std::string message = game::SrTools::instance().upload(req.body); std::string message = game::SrTools::instance().upload(req.body);
bool good = message == "OK"; bool good = message == "OK";
+5
View File
@@ -107,6 +107,11 @@ void runHttpTests() {
} }
} }
// The login SDK's experiment list needs a data list, not the catch-all stub.
std::string experiments = request(kTestPort, "POST", "/data_abtest_api/config/experiment/list", "{}");
check(succeeded(experiments) && experiments.find("\"data\":[{") != std::string::npos,
"the a/b test list carries its experiments");
// Dispatch itself: base64 protobuf, and the gateway carries the hotfix urls. // Dispatch itself: base64 protobuf, and the gateway carries the hotfix urls.
std::string dispatch = request(kTestPort, "GET", "/query_dispatch"); std::string dispatch = request(kTestPort, "GET", "/query_dispatch");
check(statusOf(dispatch) == 200, "query_dispatch answers"); check(statusOf(dispatch) == 200, "query_dispatch answers");