-
Notifications
You must be signed in to change notification settings - Fork 84
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
request options #13
Comments
You can send in basic auth by just specifying it in the URL.
What other option are you looking for? You can modify almost everything about the request if you want, so if you have something particular in mind I give you an example. |
Yeah. I saw that. I thought it would be better to have them as a part of options rather than constructing the url. More options like these - https://github.com/request/request#requestoptions-callback. - some of them which makes sense to be overridden by user,
|
So totally not documented, but you can pass any of this through: Auth isn't an object in http.request, it's a string. If you want to pass it along in that form you can send in as a parsed url (https://nodejs.org/docs/v0.12.1/api/url.html#url_url_parse_urlstr_parsequerystring_slashesdenotehost) as Maybe you're thinking about the npm |
Oh! Thanks, this should work! |
I found this issue while investigating how to have the module accept self-signed certificates. I need to pass in new JenkinsClient
baseUrl: "https://user:pass@jenkins_url"
timeout: 5000
rejectUnauthorized: false Can you clarify how to pass the |
To answer my own question, setting an environment variable as per this comment did the trick. |
These options are just the normal node See the https://nodejs.org/api/https.html#https_https_request_options_callback Something like the following should work: new require('jenkins')({
baseUrl: 'https://user:pass@jenkins_url',
timeout: 5000,
rejectUnauthorized: false,
agent: new require('https').Agent(),
}) |
@silas How do I initialize a jenkins client using api token? |
You just use basic auth and replace your password with the api token, example: var jenkins = require('jenkins')('http://' + username + ':' + apiToken + '@localhost:8080') |
@silas - thank you. It worked locally, but when I tried to get list of jobs from remote server, I received an empty array. When replaced with |
I tested on a local version of |
thanks for effort on trying it out @silas . I checked with my ops team and they shared that our jenkins server is behind a proxy... They'll get back to me once they updated some "rules" so I can retrieve jobs using api token. |
Add options to override more of the HTTP Request options, like,
{auth: { user: <user>, pass: <pass> } }
The text was updated successfully, but these errors were encountered: