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

Add optional requestHeaders argument to autoUpdater.setFeedURL #5879

Merged
merged 1 commit into from Jun 13, 2016

Conversation

Projects
None yet
3 participants
@miniak
Contributor

miniak commented Jun 5, 2016

This allows setting custom HTTP request headers, such as Authorization.

@zcbenz

This comment has been minimized.

Contributor

zcbenz commented Jun 6, 2016

How about making the headers a parameter of setFeedURL? Like this:

autoUpdater.setFeedURL('http://domain.com/update.json', {'Header': 'Value'})
@miniak

This comment has been minimized.

Contributor

miniak commented Jun 6, 2016

@zcbenz that's what I wanted to do at first, but I couldn't find an example in the code, how to get a key/value pair object input argument. Can you help me with that? I know how to make the headers argument optional.

@ssova-4xxi

This comment has been minimized.

ssova-4xxi commented Jun 6, 2016

@miniak what about windows?

@miniak

This comment has been minimized.

Contributor

miniak commented Jun 6, 2016

Squirrel for Windows does not seem to have an option to set HTTP headers

@ssova-4xxi

This comment has been minimized.

ssova-4xxi commented Jun 6, 2016

@miniak maybe add warning under windows?

@miniak

This comment has been minimized.

Contributor

miniak commented Jun 6, 2016

In the docs?

@@ -23,6 +23,9 @@ AutoUpdater.prototype.setFeedURL = function (updateURL) {
this.updateURL = updateURL
}
AutoUpdater.prototype.setRequestHeader = function (header, value) {

This comment has been minimized.

@ssova-4xxi
@miniak

This comment has been minimized.

Contributor

miniak commented Jun 6, 2016

Is stating that in the documentation not enough? I have to check what Electron does in other methods, which are platform specific

@zcbenz

This comment has been minimized.

Contributor

zcbenz commented Jun 7, 2016

@zcbenz that's what I wanted to do at first, but I couldn't find an example in the code, how to get a key/value pair object input argument. Can you help me with that? I know how to make the headers argument optional.

You need to first converting the optional argument into a base::DictionaryValue, and then iterate it. An example of iterating the base::DictionaryValue can be found at:
https://github.com/electron/electron/blob/master/atom/browser/net/atom_network_delegate.cc#L161-L174

@miniak

This comment has been minimized.

Contributor

miniak commented Jun 10, 2016

I didn't have time to work on this during the week, I am going to finish it over the weekend.

@miniak

This comment has been minimized.

Contributor

miniak commented Jun 10, 2016

@zcbenz can you please check again?

@miniak miniak changed the title from Extend autoUpdate API to Add optional requestHeaders argument to autoUpdater.setFeedURL Jun 12, 2016

@zcbenz

This comment has been minimized.

Contributor

zcbenz commented Jun 13, 2016

👍

@zcbenz zcbenz merged commit 85379e3 into electron:master Jun 13, 2016

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@miniak miniak deleted the miniak:autoUpdater branch Jun 13, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment