fix(test-app): ensure afterId parameter is always included in API requests
The /api/v2/report/plansLastUpdatedBetween endpoint requires the afterId parameter. When no previous jwtId is stored, default to "0" for the first request. This ensures afterId is always present and never null/omitted. Fix resolves "afterId parameter is required" API errors. Verified working: prefetch execution shows request body includes afterId: "0" and API returns HTTP 200 successfully.
This commit is contained in:
@@ -178,7 +178,14 @@ public class TestNativeFetcher implements NativeNotificationContentFetcher {
|
||||
// Build request body
|
||||
Map<String, Object> requestBody = new HashMap<>();
|
||||
requestBody.put("planIds", getStarredPlanIds());
|
||||
requestBody.put("afterId", getLastAcknowledgedJwtId());
|
||||
|
||||
// afterId is required by the API endpoint
|
||||
// Use "0" for first request (no previous data), or stored jwtId for subsequent requests
|
||||
String afterId = getLastAcknowledgedJwtId();
|
||||
if (afterId == null || afterId.isEmpty()) {
|
||||
afterId = "0"; // First request - start from beginning
|
||||
}
|
||||
requestBody.put("afterId", afterId);
|
||||
|
||||
String jsonBody = gson.toJson(requestBody);
|
||||
Log.d(TAG, "TestNativeFetcher: Request body: " + jsonBody);
|
||||
|
||||
Reference in New Issue
Block a user