-
Notifications
You must be signed in to change notification settings - Fork 50
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
Conversation
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.
Add https proxy support
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; |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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?
@@ -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" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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 😄 |
PR #45 is more up-to-date |
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"
});