diff --git a/src/main/java/io/supertokens/webserver/api/bulkimport/DeleteBulkImportUserAPI.java b/src/main/java/io/supertokens/webserver/api/bulkimport/DeleteBulkImportUserAPI.java index 0dd604fcd..d95e0c268 100644 --- a/src/main/java/io/supertokens/webserver/api/bulkimport/DeleteBulkImportUserAPI.java +++ b/src/main/java/io/supertokens/webserver/api/bulkimport/DeleteBulkImportUserAPI.java @@ -63,6 +63,7 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws S result.add("deletedIds", new JsonArray()); result.add("invalidIds", new JsonArray()); super.sendJsonResponse(200, result, resp); + return; } if (arr.size() > BulkImport.DELETE_USERS_MAX_LIMIT) { diff --git a/src/test/java/io/supertokens/test/bulkimport/apis/DeleteBulkImportUsersTest.java b/src/test/java/io/supertokens/test/bulkimport/apis/DeleteBulkImportUsersTest.java index 30c07597c..28906ba95 100644 --- a/src/test/java/io/supertokens/test/bulkimport/apis/DeleteBulkImportUsersTest.java +++ b/src/test/java/io/supertokens/test/bulkimport/apis/DeleteBulkImportUsersTest.java @@ -88,19 +88,6 @@ public void shouldReturn400Error() throws Exception { e.getMessage()); } } - { - try { - JsonObject request = new JsonParser().parse("{\"ids\":[]}").getAsJsonObject(); - HttpRequestForTesting.sendJsonPOSTRequest(main, "", - "http://localhost:3567/bulk-import/users/remove", - request, 1000, 1000, null, Utils.getCdiVersionStringLatestForTests(), null); - fail("The API should have thrown an error"); - } catch (io.supertokens.test.httpRequest.HttpResponseException e) { - assertEquals(400, e.statusCode); - assertEquals("Http error. Status Code: 400. Message: Field name 'ids' cannot be an empty array", - e.getMessage()); - } - } { try { // Create a string array of 500 uuids @@ -140,13 +127,13 @@ public void shouldReturn200Response() throws Exception { // Call the API with empty array { - JsonObject request = new JsonParser().parse("{\"ids\":[\"\"]}").getAsJsonObject(); - JsonObject resonse = HttpRequestForTesting.sendJsonPOSTRequest(main, "", + JsonObject request = new JsonParser().parse("{\"ids\":[]}").getAsJsonObject(); + JsonObject response = HttpRequestForTesting.sendJsonPOSTRequest(main, "", "http://localhost:3567/bulk-import/users/remove", request, 1000, 1000, null, Utils.getCdiVersionStringLatestForTests(), null); - assertEquals(0, resonse.get("deletedIds").getAsJsonArray().size()); - assertEquals(0, resonse.get("invalidIds").getAsJsonArray().size()); + assertEquals(0, response.get("deletedIds").getAsJsonArray().size()); + assertEquals(0, response.get("invalidIds").getAsJsonArray().size()); } {