cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [1/2] cordova-plugin-file-transfer git commit: Fire successCallback for any 2XX HTTP status
Date Tue, 11 Jul 2017 23:02:07 GMT
Repository: cordova-plugin-file-transfer
Updated Branches:
  refs/heads/master 5513bf302 -> 570bca0e0


Fire successCallback for any 2XX HTTP status

Found this bug when receiving a 201 response.

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/a7d3c876
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/tree/a7d3c876
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/diff/a7d3c876

Branch: refs/heads/master
Commit: a7d3c876506a0d694294c97e16d9e6b10b160c7a
Parents: 9cf583a
Author: Benjamin J DeLong <howaboutben+github@gmail.com>
Authored: Fri Jul 7 21:11:23 2017 -0300
Committer: GitHub <noreply@github.com>
Committed: Fri Jul 7 21:11:23 2017 -0300

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


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/a7d3c876/www/browser/FileTransfer.js
----------------------------------------------------------------------
diff --git a/www/browser/FileTransfer.js b/www/browser/FileTransfer.js
index 14868ac..1cc6638 100644
--- a/www/browser/FileTransfer.js
+++ b/www/browser/FileTransfer.js
@@ -161,7 +161,9 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback,
erro
                 }
 
                 xhr.onload = function() {
-                    if (this.status === 200) {
+                    // 2xx codes are valid
+                    if (this.status >= 200 &&
+                       this.status < 300) {
                         var result = new FileUploadResult(); // jshint ignore:line
                         result.bytesSent = blob.size;
                         result.responseCode = this.status;


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


Mime
View raw message