From 939bc6692bc45c714cf11bc84acfbf60020f22b9 Mon Sep 17 00:00:00 2001 From: Mayank Sanganeria Date: Tue, 2 Oct 2018 14:09:52 -0700 Subject: [PATCH] Fix requests to send (#252) --- .../src/main/java/com/leanplum/internal/Request.java | 6 +++--- .../src/test/java/com/leanplum/internal/RequestTest.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/AndroidSDKCore/src/main/java/com/leanplum/internal/Request.java b/AndroidSDKCore/src/main/java/com/leanplum/internal/Request.java index be08d47ef..4ab1a3ad7 100644 --- a/AndroidSDKCore/src/main/java/com/leanplum/internal/Request.java +++ b/AndroidSDKCore/src/main/java/com/leanplum/internal/Request.java @@ -529,7 +529,7 @@ private RequestsWithEncoding getRequestsWithEncodedStringForErrors() { unsentRequests.add(error); } requestsToSend = unsentRequests; - jsonEncodedRequestsToSend = jsonEncodeUnsentRequests(unsentRequests); + jsonEncodedRequestsToSend = jsonEncodeRequests(unsentRequests); RequestsWithEncoding requestsWithEncoding = new RequestsWithEncoding(); // for errors, we send all unsent requests so they are identical @@ -556,7 +556,7 @@ protected RequestsWithEncoding getRequestsWithEncodedStringStoredRequests(double requestsToSend = removeIrrelevantBackgroundStartRequests(unsentRequests); } - jsonEncodedRequestsToSend = jsonEncodeUnsentRequests(unsentRequests); + jsonEncodedRequestsToSend = jsonEncodeRequests(requestsToSend); requestsWithEncoding.unsentRequests = unsentRequests; requestsWithEncoding.requestsToSend = requestsToSend; requestsWithEncoding.jsonEncodedString = jsonEncodedRequestsToSend; @@ -750,7 +750,7 @@ private static List> removeIrrelevantBackgroundStartRequests return relevantRequests; } - protected static String jsonEncodeUnsentRequests(List> requestData) { + protected static String jsonEncodeRequests(List> requestData) { Map data = new HashMap<>(); data.put(Constants.Params.DATA, requestData); return JsonConverter.toJson(data); diff --git a/AndroidSDKTests/src/test/java/com/leanplum/internal/RequestTest.java b/AndroidSDKTests/src/test/java/com/leanplum/internal/RequestTest.java index c6001feec..8c84ff126 100644 --- a/AndroidSDKTests/src/test/java/com/leanplum/internal/RequestTest.java +++ b/AndroidSDKTests/src/test/java/com/leanplum/internal/RequestTest.java @@ -346,7 +346,7 @@ public void testJsonEncodeUnsentRequests() { @Test public void testGetRequestsWithEncodedStringStoredRequests() { List> requests = mockRequests(4); - String json = Request.jsonEncodeUnsentRequests(requests); + String json = Request.jsonEncodeRequests(requests); final String expectedJson = "{\"data\":[{\"0\":\"testData\"},{\"1\":\"testData\"},{\"2\":\"testData\"},{\"3\":\"testData\"}]}"; assertEquals(json, expectedJson);