cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] maverickmishra closed pull request #146: Adds support to PATCH method
Date Thu, 01 Jan 1970 00:00:00 GMT
maverickmishra closed pull request #146: Adds support to PATCH method

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/ b/
index d293cfa..f47b4e2 100644
--- a/
+++ b/
@@ -66,7 +66,7 @@ cordova plugin add cordova-plugin-file-transfer
 # FileTransfer
 The `FileTransfer` object provides a way to upload files using an HTTP
-multi-part POST or PUT request, and to download files.
+multi-part POST, PUT OR PATCH request, and to download files.
 ## Properties
@@ -96,7 +96,7 @@ __Parameters__:
 - __options__: Optional parameters _(Object)_. Valid keys:
   - __fileKey__: The name of the form element.  Defaults to `file`. (DOMString)
   - __fileName__: The file name to use when saving the file on the server.  Defaults to `image.jpg`.
-  - __httpMethod__: The HTTP method to use - either `PUT` or `POST`. Defaults to `POST`.
+  - __httpMethod__: The HTTP method to use - either `PATCH` or `PUT` or `POST`. Defaults
to `POST`. (DOMString)
   - __mimeType__: The mime type of the data to upload.  Defaults to `image/jpeg`. (DOMString)
   - __params__: A set of optional key/value pairs to pass in the HTTP request. (Object, key/value
- DOMString)
   - __chunkedMode__: Whether to upload the data in chunked streaming mode. Defaults to `true`.
@@ -173,7 +173,7 @@ ft.onprogress = function(progressEvent) {
 ft.upload(fileURL, uri, win, fail, options);
 ## FileUploadResult
 A `FileUploadResult` object is passed to the success callback of the
diff --git a/www/FileTransfer.js b/www/FileTransfer.js
index 80cf91c..ced48ae 100644
--- a/www/FileTransfer.js
+++ b/www/FileTransfer.js
@@ -127,8 +127,10 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback,
         httpMethod = options.httpMethod || "POST";
         if (httpMethod.toUpperCase() == "PUT"){
             httpMethod = "PUT";
-        } else {
+        } else if (httpMethod.toUpperCase() == "POST"){
             httpMethod = "POST";
+        } else if (httpMethod.toUpperCase() == "PATCH"){
+            httpMethod = "PATCH";
         if (options.chunkedMode !== null || typeof options.chunkedMode != "undefined") {
             chunkedMode = options.chunkedMode;


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:

With regards,
Apache Git Services

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message