cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [1/4] cordova-plugin-file-transfer git commit: Added option to allow for passing cookies automatically in the browser
Date Thu, 18 Jun 2015 03:11:54 GMT
Repository: cordova-plugin-file-transfer
Updated Branches:
  refs/heads/master 2d7d14e9e -> 2bc020d6d


Added option to allow for passing cookies automatically in the browser


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/commit/051ada10
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/tree/051ada10
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/diff/051ada10

Branch: refs/heads/master
Commit: 051ada102e617478a1a47c1eee8d224665f45b88
Parents: a2c1194
Author: aroberson <adam.roberson@ventyx.abb.com>
Authored: Mon Jun 15 15:54:27 2015 -0500
Committer: aroberson <adam.roberson@ventyx.abb.com>
Committed: Mon Jun 15 15:54:27 2015 -0500

----------------------------------------------------------------------
 www/browser/FileTransfer.js | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/051ada10/www/browser/FileTransfer.js
----------------------------------------------------------------------
diff --git a/www/browser/FileTransfer.js b/www/browser/FileTransfer.js
index e142222..98816ee 100644
--- a/www/browser/FileTransfer.js
+++ b/www/browser/FileTransfer.js
@@ -109,6 +109,7 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback,
erro
     var fileName = options.fileName || "image.jpg";
     var mimeType = options.mimeType || "image/jpeg";
     var params = options.params || {};
+    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";
@@ -121,6 +122,9 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback,
erro
 
     var that = this;
     var xhr = transfers[this._id] = new XMLHttpRequest();
+    if (withCredentials) {
+        xhr.withCredentials = true;
+    }
 
     var fail = errorCallback && function(code, status, response) {
         transfers[this._id] && delete transfers[this._id];
@@ -222,6 +226,7 @@ FileTransfer.prototype.download = function(source, target, successCallback,
erro
     options = options || {};
     
     var headers = options.headers || {};
+    var withCredentials = options.withCredentials || false;
 
     var basicAuthHeader = getBasicAuthHeader(source);
     if (basicAuthHeader) {
@@ -231,7 +236,9 @@ FileTransfer.prototype.download = function(source, target, successCallback,
erro
 
     var that = this;
     var xhr = transfers[this._id] = new XMLHttpRequest();
-    
+    if (withCredentials) {
+        xhr.withCredentials = true;
+    }
     var fail = errorCallback && function(code, status, response) {
         transfers[that._id] && delete transfers[that._id];
         // In XHR GET reqests we're setting response type to Blob


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


Mime
View raw message