From 9575fd1465e4202356732f826f56c297ce3c0baf Mon Sep 17 00:00:00 2001 From: Netanel Gilad Date: Sun, 22 Jul 2018 15:34:07 +0300 Subject: [PATCH] add support for setting proxy --- .../com/synconset/cordovahttp/CordovaHttpPlugin.java | 6 ++++++ www/advanced-http.js | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/android/com/synconset/cordovahttp/CordovaHttpPlugin.java b/src/android/com/synconset/cordovahttp/CordovaHttpPlugin.java index ccf218c8..0cd58564 100644 --- a/src/android/com/synconset/cordovahttp/CordovaHttpPlugin.java +++ b/src/android/com/synconset/cordovahttp/CordovaHttpPlugin.java @@ -128,6 +128,12 @@ else if (action.equals("delete")) { boolean disable = args.getBoolean(0); CordovaHttp.disableRedirect(disable); callbackContext.success(); + } else if (action.equals("setProxy")) { + String host = args.getString(0); + int port = args.getInt(1); + HttpRequest.proxyHost(host); + HttpRequest.proxyPort(port); + callbackContext.success(); } else { return false; } diff --git a/www/advanced-http.js b/www/advanced-http.js index 74173c87..7fa605b2 100644 --- a/www/advanced-http.js +++ b/www/advanced-http.js @@ -72,6 +72,9 @@ var publicInterface = { disableRedirect: function (disable, success, failure) { return exec(success, failure, 'CordovaHttpPlugin', 'disableRedirect', [ !!disable ]); }, + setProxy: function(host, port, success, failure) { + return exec(success, failure, 'CordovaHttpPlugin', 'setProxy', [ host, port ]); + }, sendRequest: function (url, options, success, failure) { helpers.handleMissingCallbacks(success, failure);