From 132ed07af75076dfbc7643533e043d9a7eda652f Mon Sep 17 00:00:00 2001 From: Demian Gemperli Date: Wed, 19 Aug 2015 18:16:23 +0200 Subject: [PATCH] Fix cordova file transfer download --- cordova/cordova-tests.ts | 8 ++++++-- cordova/plugins/FileTransfer.d.ts | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cordova/cordova-tests.ts b/cordova/cordova-tests.ts index d162b1ab66..491b49773a 100644 --- a/cordova/cordova-tests.ts +++ b/cordova/cordova-tests.ts @@ -176,8 +176,12 @@ file.download('http://some.server.com/download.php', console.error('Failed with exception ' + err.exception); } }, - { headers: null }, - true); + true, + { + headers: { + "Authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA==" + } + }); file.upload('cdvfile://localhost/persistent/path/to/downloads/', 'http://some.server.com/download.php', diff --git a/cordova/plugins/FileTransfer.d.ts b/cordova/plugins/FileTransfer.d.ts index d0c023ae8a..7cbde5322d 100644 --- a/cordova/plugins/FileTransfer.d.ts +++ b/cordova/plugins/FileTransfer.d.ts @@ -53,8 +53,8 @@ interface FileTransfer { target: string, successCallback: (fileEntry: FileEntry) => void, errorCallback: (error: FileTransferError) => void, - options?: FileDownloadOptions, - trustAllHosts?: boolean): void; + trustAllHosts?: boolean, + options?: FileDownloadOptions): void; /** * Aborts an in-progress transfer. The onerror callback is passed a FileTransferError object * which has an error code of FileTransferError.ABORT_ERR. @@ -98,8 +98,8 @@ interface FileUploadOptions { /** Optional parameters for download method. */ interface FileDownloadOptions { - /** A map of header name/header values. Use an array to specify more than one value. */ - headers?: Object[]; + /** A map of header name/header values. */ + headers?: {}; } /** A FileTransferError object is passed to an error callback when an error occurs. */