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

Add https proxy support #39

Closed
wants to merge 5 commits into from
Closed

Add https proxy support #39

wants to merge 5 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Feb 16, 2016

Hi Scott,

Sorry for the lack of documentation. I have updated the readme.md file with documentation.

reason for the new option:
While being behind a (corporate) proxy I am not able to make direct http requests to browserstack without going through the proxy. In order to achieve this proxy support is desired.

format of the option:

settings {
proxy: "http://host:port"
}

code example:

var client = BrowserStack.createClient({
username: "foo",
password: "p455w0rd!!1",
proxy: "http://myproxy.com:1234"
});

var screenshotClient = BrowserStack.createScreenshotClient({
username: "foo",
password: "p455w0rd!!1",
proxy: "http://myproxy.com:1234"
});

teunvandemerwe added 3 commits February 16, 2016 09:28
To access "api.browserstack.com" behind a proxy it is needed to add a
https proxy. Added support for a https proxy
Added https proxy to access api.browserstack.com" behind a proxy.
@scottgonzalez
Copy link
Owner

Thanks. Can you please provide actual documentation for this feature? This requires documenting the reason for the new options, providing the actual format of the option, and providing a legitimate code example (i.e., one that wouldn't cause syntax errors when copied).

@@ -6,6 +6,7 @@ function ApiBaseClient(settings) {
this.server = {
host: "api.browserstack.com"
};
this.https_proxy = settings.https_proxy || null;
Copy link
Owner

Choose a reason for hiding this comment

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

Rename this to just proxy.

Copy link
Owner

Choose a reason for hiding this comment

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

Why is this done in the API layer only?

- Rename https_proxy to proxy
- Added proxy to ScreenshotClient
- Added documentation
@@ -18,7 +18,8 @@ var BrowserStack = require( "browserstack" );
// REST API
var client = BrowserStack.createClient({
username: "foo",
password: "p455w0rd!!1"
password: "p455w0rd!!1",
proxy (optional): "http://myproxy.com:1234"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be copy-pastable code and the parenthesis would throw a syntax exception... I'd suggest replacing it by

proxy: "http://myproxy.com:1234" // proxy configuration is optional

Or even not stating it at all in the docs' examples, I guess it is not such a common use case.

Copy link
Owner

Choose a reason for hiding this comment

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

I'd say the option should be documented, but should not be used in the sample code.

This is similar to the host option in my wordpress module. It's documented in createClient(), but not shown in the usage example.

@kartsims
Copy link
Collaborator

Hi Teun,

I did a quick code review (no testing) and left a couple comments. I was wondering if you think this implementation could be adapted to the other APIs ? It seems quite generic so why not use it for Automate and REST APIs ..?

I can help with that if needed 😄

@kartsims
Copy link
Collaborator

PR #45 is more up-to-date

@kartsims kartsims closed this Apr 18, 2016
scottgonzalez pushed a commit that referenced this pull request Apr 21, 2016
To access "api.browserstack.com" behind a proxy it is needed to add a
https proxy.

Ref #39
Ref #45
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