From ca8c9d692006beaa40a9930887b60957b2c25116 Mon Sep 17 00:00:00 2001 From: Shubham Goyal Date: Tue, 27 Nov 2018 15:44:07 +0700 Subject: [PATCH] Disable retries for Post requests --- app/src/org/commcare/CommCareApplication.java | 7 ++++--- app/src/org/commcare/network/CommcareRequestGenerator.java | 3 ++- app/src/org/commcare/tasks/ModernHttpTask.java | 3 ++- .../src/org/commcare/CommCareTestApplication.java | 5 +++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/src/org/commcare/CommCareApplication.java b/app/src/org/commcare/CommCareApplication.java index 350de7dda7..3fd3da039e 100644 --- a/app/src/org/commcare/CommCareApplication.java +++ b/app/src/org/commcare/CommCareApplication.java @@ -1090,7 +1090,7 @@ public static CommCareNoficationManager notificationManager() { public ModernHttpRequester buildHttpRequester(Context context, String url, Map params, HashMap headers, RequestBody requestBody, List parts, HTTPMethod method, @Nullable Pair usernameAndPasswordToAuthWith, - @Nullable HttpResponseProcessor responseProcessor) { + @Nullable HttpResponseProcessor responseProcessor, boolean retry) { return new ModernHttpRequester(new AndroidCacheDirSetup(context), url, params, @@ -1099,7 +1099,8 @@ public ModernHttpRequester buildHttpRequester(Context context, String url, Map params, HashMap headers, @Nullable Pair usernameAndPasswordToAuthWith, @Nullable HttpResponseProcessor responseProcessor) { - return buildHttpRequester(context, url, params, headers, null, null, HTTPMethod.GET, usernameAndPasswordToAuthWith, responseProcessor); + return buildHttpRequester(context, url, params, headers, null, null, HTTPMethod.GET, usernameAndPasswordToAuthWith, responseProcessor, true); } } diff --git a/app/src/org/commcare/network/CommcareRequestGenerator.java b/app/src/org/commcare/network/CommcareRequestGenerator.java index 528ed2a2de..d53883887f 100755 --- a/app/src/org/commcare/network/CommcareRequestGenerator.java +++ b/app/src/org/commcare/network/CommcareRequestGenerator.java @@ -209,7 +209,8 @@ public Response postMultipart(String url, List parts, HTTPMethod.MULTIPART_POST, new Pair(username, password), - null); + null, + false); return requester.makeRequest(); } diff --git a/app/src/org/commcare/tasks/ModernHttpTask.java b/app/src/org/commcare/tasks/ModernHttpTask.java index 431fe91d06..a9cbb94927 100644 --- a/app/src/org/commcare/tasks/ModernHttpTask.java +++ b/app/src/org/commcare/tasks/ModernHttpTask.java @@ -56,7 +56,8 @@ public ModernHttpTask(Context context, String url, HashMap param null, method, usernameAndPasswordToAuthWith, - this); + this, + method.equals(HTTPMethod.GET) ? true : false); } @Override diff --git a/app/unit-tests/src/org/commcare/CommCareTestApplication.java b/app/unit-tests/src/org/commcare/CommCareTestApplication.java index 1220299101..39badfe369 100644 --- a/app/unit-tests/src/org/commcare/CommCareTestApplication.java +++ b/app/unit-tests/src/org/commcare/CommCareTestApplication.java @@ -249,7 +249,7 @@ public void prepareTest(Object test) { @Override public ModernHttpRequester buildHttpRequester(Context context, String url, Map params, HashMap headers, RequestBody requestBody, List parts, - HTTPMethod method, @Nullable Pair usernameAndPasswordToAuthWith, HttpResponseProcessor responseProcessor) { + HTTPMethod method, @Nullable Pair usernameAndPasswordToAuthWith, HttpResponseProcessor responseProcessor, boolean b) { return new ModernHttpRequesterMock(new AndroidCacheDirSetup(context), url, params, @@ -258,7 +258,8 @@ public ModernHttpRequester buildHttpRequester(Context context, String url, Map