mirror of
https://github.com/apache/cordova-plugin-file-transfer.git
synced 2026-04-10 00:00:03 +08:00
fix merge
This commit is contained in:
@@ -63,6 +63,20 @@ function getBasicAuthHeader(urlString) {
|
||||
return header;
|
||||
}
|
||||
|
||||
function convertHeadersToArray(headers) {
|
||||
var result = [];
|
||||
for (var header in headers) {
|
||||
if (headers.hasOwnProperty(header)) {
|
||||
var headerValue = headers[header];
|
||||
result.push({
|
||||
name: header,
|
||||
value: headerValue.toString()
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
var idCounter = 0;
|
||||
|
||||
/**
|
||||
@@ -125,6 +139,11 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback, erro
|
||||
}
|
||||
}
|
||||
|
||||
if (cordova.platformId === "windowsphone") {
|
||||
headers = headers && convertHeadersToArray(headers);
|
||||
params = params && convertHeadersToArray(params);
|
||||
}
|
||||
|
||||
var fail = errorCallback && function(e) {
|
||||
var error = new FileTransferError(e.code, e.source, e.target, e.http_status, e.body, e.exception);
|
||||
errorCallback(error);
|
||||
@@ -170,6 +189,10 @@ FileTransfer.prototype.download = function(source, target, successCallback, erro
|
||||
headers = options.headers || null;
|
||||
}
|
||||
|
||||
if (cordova.platformId === "windowsphone" && headers) {
|
||||
headers = convertHeadersToArray(headers);
|
||||
}
|
||||
|
||||
var win = function(result) {
|
||||
if (typeof result.lengthComputable != "undefined") {
|
||||
if (self.onprogress) {
|
||||
|
||||
Reference in New Issue
Block a user