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

Externalizing request options #153

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: node_js
node_js:
- "0.10"
- "6.4.0"
before_install: npm install -g grunt-cli
install: npm install
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,37 @@ or

### Create the JIRA client ###

#### Create a simple JIRA client ####

JiraApi = require('jira').JiraApi;

var jira = new JiraApi('https', config.host, config.port, config.user, config.password, '2.0.alpha1');

#### Need special HTTP settings ####

In the case of, if some particular settings are needed to sign in like proxy authentication, for example. This can be done by passing the HTTP request options as parameter of the jiraApiWithOptions method.

const HttpProxyAgent = require("http-proxy-agent");
const agent = new HttpProxyAgent("http://proxy");
const options = {
"agent": agent, // proxy setting
rejectUnauthorized: this.strictSSL, // strict ssl option
headers: {
"Proxy-Authorization": "Bearer authentication_token", // proxy authentification
"Authorization": 'Basic ' + Buffer.from(username + ':' + password).toString('base64') // basic authentication
},
oauth: { // in the case of oauth instead of basic
consumer_key: oauth.consumer_key,
consumer_secret: oauth.consumer_secret,
token: oauth.access_token,
token_secret: oauth.access_token_secret
}
}
JiraApiWithOptions = require('jira').JiraApiWithOptions;

var jira = new JiraApiWithOptions('https', 'server.com', '443', '2.0.alpha1', true, 'jira', options);


### Find the status of an issue ###

jira.findIssue(issueNumber, function(error, issue) {
Expand Down
Loading