You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2017/11/22 00:23:46 UTC

[GitHub] maverickmishra closed pull request #168: patch method

maverickmishra closed pull request #168: patch method
URL: https://github.com/apache/cordova-plugin-file-transfer/pull/168
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/www/FileTransfer.js b/www/FileTransfer.js
index 80cf91c..08db6c3 100644
--- a/www/FileTransfer.js
+++ b/www/FileTransfer.js
@@ -125,7 +125,9 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback, erro
         mimeType = options.mimeType;
         headers = options.headers;
         httpMethod = options.httpMethod || "POST";
-        if (httpMethod.toUpperCase() == "PUT"){
+        if (httpMethod.toUpperCase() == "PATCH") {
+            httpMethod = "PATCH";
+        } else if (httpMethod.toUpperCase() == "PUT") {
             httpMethod = "PUT";
         } else {
             httpMethod = "POST";
diff --git a/www/blackberry10/FileTransfer.js b/www/blackberry10/FileTransfer.js
index 76e1682..75ca4ef 100644
--- a/www/blackberry10/FileTransfer.js
+++ b/www/blackberry10/FileTransfer.js
@@ -100,7 +100,9 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback, erro
         mimeType = options.mimeType;
         headers = options.headers;
         httpMethod = options.httpMethod || "POST";
-        if (httpMethod.toUpperCase() == "PUT"){
+        if (httpMethod.toUpperCase() == "PATCH") {
+            httpMethod = "PATCH";
+        } else if (httpMethod.toUpperCase() == "PUT") {
             httpMethod = "PUT";
         } else {
             httpMethod = "POST";
diff --git a/www/browser/FileTransfer.js b/www/browser/FileTransfer.js
index 14868ac..8bd1016 100644
--- a/www/browser/FileTransfer.js
+++ b/www/browser/FileTransfer.js
@@ -114,7 +114,14 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback, erro
     var withCredentials = options.withCredentials || false;
     // var chunkedMode = !!options.chunkedMode; // Not supported
     var headers = options.headers || {};
-    var httpMethod = options.httpMethod && options.httpMethod.toUpperCase() === "PUT" ? "PUT" : "POST";
+    var httpMethod = options.httpMethod || "POST";
+    if (httpMethod.toUpperCase() == "PATCH") {
+        httpMethod = "PATCH";
+    } else if (httpMethod.toUpperCase() == "PUT") {
+        httpMethod = "PUT";
+    } else {
+        httpMethod = "POST";
+    }
 
     var basicAuthHeader = getBasicAuthHeader(server);
     if (basicAuthHeader) {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org