From 52b2efe71b78f85462a289cf76e61cd912dc0adf Mon Sep 17 00:00:00 2001 From: Sefa Ilkimen Date: Mon, 2 Oct 2017 16:17:29 +0200 Subject: [PATCH] fixed PATCH method on android --- CHANGELOG.md | 4 ++++ .../cordovahttp/CordovaHttpDelete.java | 2 +- .../cordovahttp/CordovaHttpDownload.java | 2 +- .../synconset/cordovahttp/CordovaHttpGet.java | 2 +- .../synconset/cordovahttp/CordovaHttpHead.java | 2 +- .../synconset/cordovahttp/CordovaHttpPatch.java | 2 +- .../cordovahttp/CordovaHttpPlugin.java | 17 +++++++++-------- .../synconset/cordovahttp/CordovaHttpPost.java | 2 +- .../synconset/cordovahttp/CordovaHttpPut.java | 2 +- .../cordovahttp/CordovaHttpUpload.java | 2 +- 10 files changed, 21 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e04286f..11b6df6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v1.6.1 + +- Fixed #23: PATCH method broken on android + ## v1.6.0 - Feature #18: implemented PATCH method (thanks akhatri for android implementation) diff --git a/src/android/com/synconset/cordovahttp/CordovaHttpDelete.java b/src/android/com/synconset/cordovahttp/CordovaHttpDelete.java index dbc8c96..f522d1e 100644 --- a/src/android/com/synconset/cordovahttp/CordovaHttpDelete.java +++ b/src/android/com/synconset/cordovahttp/CordovaHttpDelete.java @@ -17,7 +17,7 @@ import com.github.kevinsawicki.http.HttpRequest; import com.github.kevinsawicki.http.HttpRequest.HttpRequestException; class CordovaHttpDelete extends CordovaHttp implements Runnable { - public CordovaHttpDelete(String urlString, JSONObject data, JSONObject headers, CallbackContext callbackContext, int timeout) { + public CordovaHttpDelete(String urlString, JSONObject data, JSONObject headers, int timeout, CallbackContext callbackContext) { super(urlString, data, headers, timeout, callbackContext); } diff --git a/src/android/com/synconset/cordovahttp/CordovaHttpDownload.java b/src/android/com/synconset/cordovahttp/CordovaHttpDownload.java index 26268b1..53aa517 100644 --- a/src/android/com/synconset/cordovahttp/CordovaHttpDownload.java +++ b/src/android/com/synconset/cordovahttp/CordovaHttpDownload.java @@ -23,7 +23,7 @@ import org.json.JSONObject; class CordovaHttpDownload extends CordovaHttp implements Runnable { private String filePath; - public CordovaHttpDownload(String urlString, JSONObject params, JSONObject headers, CallbackContext callbackContext, String filePath, int timeout) { + public CordovaHttpDownload(String urlString, JSONObject params, JSONObject headers, String filePath, int timeout, CallbackContext callbackContext) { super(urlString, params, headers, timeout, callbackContext); this.filePath = filePath; } diff --git a/src/android/com/synconset/cordovahttp/CordovaHttpGet.java b/src/android/com/synconset/cordovahttp/CordovaHttpGet.java index 44360a9..8ce9a89 100644 --- a/src/android/com/synconset/cordovahttp/CordovaHttpGet.java +++ b/src/android/com/synconset/cordovahttp/CordovaHttpGet.java @@ -17,7 +17,7 @@ import com.github.kevinsawicki.http.HttpRequest; import com.github.kevinsawicki.http.HttpRequest.HttpRequestException; class CordovaHttpGet extends CordovaHttp implements Runnable { - public CordovaHttpGet(String urlString, JSONObject params, JSONObject headers, CallbackContext callbackContext, int timeout) { + public CordovaHttpGet(String urlString, JSONObject params, JSONObject headers, int timeout, CallbackContext callbackContext) { super(urlString, params, headers, timeout, callbackContext); } diff --git a/src/android/com/synconset/cordovahttp/CordovaHttpHead.java b/src/android/com/synconset/cordovahttp/CordovaHttpHead.java index 46f4c6f..f545a59 100644 --- a/src/android/com/synconset/cordovahttp/CordovaHttpHead.java +++ b/src/android/com/synconset/cordovahttp/CordovaHttpHead.java @@ -16,7 +16,7 @@ import com.github.kevinsawicki.http.HttpRequest; import com.github.kevinsawicki.http.HttpRequest.HttpRequestException; class CordovaHttpHead extends CordovaHttp implements Runnable { - public CordovaHttpHead(String urlString, JSONObject params, JSONObject headers, CallbackContext callbackContext, int timeout) { + public CordovaHttpHead(String urlString, JSONObject params, JSONObject headers, int timeout, CallbackContext callbackContext) { super(urlString, params, headers, timeout, callbackContext); } diff --git a/src/android/com/synconset/cordovahttp/CordovaHttpPatch.java b/src/android/com/synconset/cordovahttp/CordovaHttpPatch.java index bcd60fb..cf88bb9 100644 --- a/src/android/com/synconset/cordovahttp/CordovaHttpPatch.java +++ b/src/android/com/synconset/cordovahttp/CordovaHttpPatch.java @@ -16,7 +16,7 @@ import com.github.kevinsawicki.http.HttpRequest; import com.github.kevinsawicki.http.HttpRequest.HttpRequestException; class CordovaHttpPatch extends CordovaHttp implements Runnable { - public CordovaHttpPatch(String urlString, JSONObject params, String serializerName, JSONObject headers, CallbackContext callbackContext, int timeout) { + public CordovaHttpPatch(String urlString, JSONObject params, String serializerName, JSONObject headers, int timeout, CallbackContext callbackContext) { super(urlString, params, serializerName, headers, timeout, callbackContext); } diff --git a/src/android/com/synconset/cordovahttp/CordovaHttpPlugin.java b/src/android/com/synconset/cordovahttp/CordovaHttpPlugin.java index b69897e..8a26e52 100644 --- a/src/android/com/synconset/cordovahttp/CordovaHttpPlugin.java +++ b/src/android/com/synconset/cordovahttp/CordovaHttpPlugin.java @@ -40,7 +40,7 @@ public class CordovaHttpPlugin extends CordovaPlugin { String serializerName = args.getString(2); JSONObject headers = args.getJSONObject(3); int timeoutInMilliseconds = args.getInt(4) * 1000; - CordovaHttpPost post = new CordovaHttpPost(urlString, params, serializerName, headers, callbackContext, timeoutInMilliseconds); + CordovaHttpPost post = new CordovaHttpPost(urlString, params, serializerName, headers, timeoutInMilliseconds, callbackContext); cordova.getThreadPool().execute(post); } else if (action.equals("get")) { @@ -48,7 +48,7 @@ public class CordovaHttpPlugin extends CordovaPlugin { JSONObject params = args.getJSONObject(1); JSONObject headers = args.getJSONObject(2); int timeoutInMilliseconds = args.getInt(3) * 1000; - CordovaHttpGet get = new CordovaHttpGet(urlString, params, headers, callbackContext, timeoutInMilliseconds); + CordovaHttpGet get = new CordovaHttpGet(urlString, params, headers, timeoutInMilliseconds, callbackContext); cordova.getThreadPool().execute(get); } else if (action.equals("put")) { @@ -57,7 +57,7 @@ public class CordovaHttpPlugin extends CordovaPlugin { String serializerName = args.getString(2); JSONObject headers = args.getJSONObject(3); int timeoutInMilliseconds = args.getInt(4) * 1000; - CordovaHttpPut put = new CordovaHttpPut(urlString, params, serializerName, headers, callbackContext, timeoutInMilliseconds); + CordovaHttpPut put = new CordovaHttpPut(urlString, params, serializerName, headers, timeoutInMilliseconds, callbackContext); cordova.getThreadPool().execute(put); } else if (action.equals("patch")) { @@ -65,7 +65,8 @@ public class CordovaHttpPlugin extends CordovaPlugin { JSONObject params = args.getJSONObject(1); String serializerName = args.getString(2); JSONObject headers = args.getJSONObject(3); - CordovaHttpPatch patch = new CordovaHttpPatch(urlString, params, serializerName, headers, callbackContext); + int timeoutInMilliseconds = args.getInt(4) * 1000; + CordovaHttpPatch patch = new CordovaHttpPatch(urlString, params, serializerName, headers, timeoutInMilliseconds, callbackContext); cordova.getThreadPool().execute(patch); } @@ -74,7 +75,7 @@ public class CordovaHttpPlugin extends CordovaPlugin { JSONObject params = args.getJSONObject(1); JSONObject headers = args.getJSONObject(2); int timeoutInMilliseconds = args.getInt(3) * 1000; - CordovaHttpDelete delete = new CordovaHttpDelete(urlString, params, headers, callbackContext, timeoutInMilliseconds); + CordovaHttpDelete delete = new CordovaHttpDelete(urlString, params, headers, timeoutInMilliseconds, callbackContext); cordova.getThreadPool().execute(delete); } else if (action.equals("head")) { @@ -82,7 +83,7 @@ public class CordovaHttpPlugin extends CordovaPlugin { JSONObject params = args.getJSONObject(1); JSONObject headers = args.getJSONObject(2); int timeoutInMilliseconds = args.getInt(3) * 1000; - CordovaHttpHead head = new CordovaHttpHead(urlString, params, headers, callbackContext, timeoutInMilliseconds); + CordovaHttpHead head = new CordovaHttpHead(urlString, params, headers, timeoutInMilliseconds, callbackContext); cordova.getThreadPool().execute(head); } else if (action.equals("enableSSLPinning")) { @@ -111,7 +112,7 @@ public class CordovaHttpPlugin extends CordovaPlugin { String filePath = args.getString(3); String name = args.getString(4); int timeoutInMilliseconds = args.getInt(5) * 1000; - CordovaHttpUpload upload = new CordovaHttpUpload(urlString, params, headers, callbackContext, filePath, name, timeoutInMilliseconds); + CordovaHttpUpload upload = new CordovaHttpUpload(urlString, params, headers, filePath, name, timeoutInMilliseconds, callbackContext); cordova.getThreadPool().execute(upload); } else if (action.equals("downloadFile")) { @@ -120,7 +121,7 @@ public class CordovaHttpPlugin extends CordovaPlugin { JSONObject headers = args.getJSONObject(2); String filePath = args.getString(3); int timeoutInMilliseconds = args.getInt(4) * 1000; - CordovaHttpDownload download = new CordovaHttpDownload(urlString, params, headers, callbackContext, filePath, timeoutInMilliseconds); + CordovaHttpDownload download = new CordovaHttpDownload(urlString, params, headers, filePath, timeoutInMilliseconds, callbackContext); cordova.getThreadPool().execute(download); } else if (action.equals("disableRedirect")) { diff --git a/src/android/com/synconset/cordovahttp/CordovaHttpPost.java b/src/android/com/synconset/cordovahttp/CordovaHttpPost.java index b64c1a3..7fbb2d0 100644 --- a/src/android/com/synconset/cordovahttp/CordovaHttpPost.java +++ b/src/android/com/synconset/cordovahttp/CordovaHttpPost.java @@ -16,7 +16,7 @@ import com.github.kevinsawicki.http.HttpRequest; import com.github.kevinsawicki.http.HttpRequest.HttpRequestException; class CordovaHttpPost extends CordovaHttp implements Runnable { - public CordovaHttpPost(String urlString, JSONObject params, String serializerName, JSONObject headers, CallbackContext callbackContext, int timeout) { + public CordovaHttpPost(String urlString, JSONObject params, String serializerName, JSONObject headers, int timeout, CallbackContext callbackContext) { super(urlString, params, serializerName, headers, timeout, callbackContext); } diff --git a/src/android/com/synconset/cordovahttp/CordovaHttpPut.java b/src/android/com/synconset/cordovahttp/CordovaHttpPut.java index 1626e63..5d58d8a 100644 --- a/src/android/com/synconset/cordovahttp/CordovaHttpPut.java +++ b/src/android/com/synconset/cordovahttp/CordovaHttpPut.java @@ -16,7 +16,7 @@ import com.github.kevinsawicki.http.HttpRequest; import com.github.kevinsawicki.http.HttpRequest.HttpRequestException; class CordovaHttpPut extends CordovaHttp implements Runnable { - public CordovaHttpPut(String urlString, JSONObject data, String serializerName, JSONObject headers, CallbackContext callbackContext, int timeout) { + public CordovaHttpPut(String urlString, JSONObject data, String serializerName, JSONObject headers, int timeout, CallbackContext callbackContext) { super(urlString, data, serializerName, headers, timeout, callbackContext); } diff --git a/src/android/com/synconset/cordovahttp/CordovaHttpUpload.java b/src/android/com/synconset/cordovahttp/CordovaHttpUpload.java index 39bba4b..2224b3c 100644 --- a/src/android/com/synconset/cordovahttp/CordovaHttpUpload.java +++ b/src/android/com/synconset/cordovahttp/CordovaHttpUpload.java @@ -30,7 +30,7 @@ class CordovaHttpUpload extends CordovaHttp implements Runnable { private String filePath; private String name; - public CordovaHttpUpload(String urlString, JSONObject params, JSONObject headers, CallbackContext callbackContext, String filePath, String name, int timeout) { + public CordovaHttpUpload(String urlString, JSONObject params, JSONObject headers, String filePath, String name, int timeout, CallbackContext callbackContext) { super(urlString, params, headers, timeout, callbackContext); this.filePath = filePath; this.name = name;