From 58a82b61e8cdc6aff9ebf172937644b9c46d4087 Mon Sep 17 00:00:00 2001 From: capyb2222 Date: Sat, 12 Sep 2026 22:01:22 -0700 Subject: [PATCH] fix(dispatch): answer the login a/b test list --- src/sdk/routes.cpp | 12 ++++++++++++ tests/test_http.cpp | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/src/sdk/routes.cpp b/src/sdk/routes.cpp index 3c55bb9..09f55e9 100644 --- a/src/sdk/routes.cpp +++ b/src/sdk/routes.cpp @@ -239,6 +239,18 @@ void registerRoutes(http::Server& server) { }); // ---- 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) { std::string message = game::SrTools::instance().upload(req.body); bool good = message == "OK"; diff --git a/tests/test_http.cpp b/tests/test_http.cpp index f88d14c..8b4426e 100644 --- a/tests/test_http.cpp +++ b/tests/test_http.cpp @@ -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. std::string dispatch = request(kTestPort, "GET", "/query_dispatch"); check(statusOf(dispatch) == 200, "query_dispatch answers");