Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CB-861] Header support for FileTransfer download #21

Closed
wants to merge 2 commits into from

Conversation

devgeeks
Copy link
Member

Added support for an optional options object as the final arg. Currently only handles the options.headers object (as per the issue).

FileTransfer.download(source, target, successCallback, errorCallback, trustAllHosts, options)

This is needed for using FileTransfer.download with Basic Authentication, etc. Sadly since Android 2.x doesn't support XHR2, this is needed in FileTransfer.

I have only added support to Android and iOS (see other PR's). It might be that the JS args need to be in a different order or handled differently so that it doesn't impact the other platforms. I am hoping I can get advice on that from someone.

If there is anything else I need to do, just let me know.

//cc @agrieve - for suggesting I do this myself

Added support for an optional options object as the final arg. Currently only handles the options.headers object (as per the issue).

`FileTransfer.download(source, target, successCallback, errorCallback, trustAllHosts, options)`

This is needed for using FileTransfer.download with Basic Authentication, etc. Sadly since Android 2.x doesn't support XHR2, this is needed in FileTransfer.

I have only added support to Android and iOS (see other PR's).
@@ -615,7 +615,9 @@ private void download(final String source, final String target, JSONArray args,
Log.d(LOG_TAG, "download " + source + " to " + target);

final boolean trustEveryone = args.optBoolean(2);
final String objectId = args.getString(3);
final JSONObject headers = args.optJSONObject(3);
Log.d(LOG_TAG, "headers: " + headers);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this line please

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another case of copying the behaviour of the upload method. It Log.d's all the parameters passed to it.

As per discussion with @agrieve I have moved the addition of the headers to the connection for both the upload and download methods to a helper method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants