Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ba025cd

Browse files
llecarozzoraceslap
authored andcommittedDec 7, 2018
Add JiraApiWithOptions documentation in the README.md
1 parent edcf0e1 commit ba025cd

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed
 

‎README.md

+27
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,37 @@ or
2929

3030
### Create the JIRA client ###
3131

32+
#### Create a simple JIRA client ####
33+
3234
JiraApi = require('jira').JiraApi;
3335

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

38+
#### Need special HTTP settings ####
39+
40+
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.
41+
42+
const HttpProxyAgent = require("http-proxy-agent");
43+
const agent = new HttpProxyAgent("http://proxy");
44+
const options = {
45+
"agent": agent, // proxy setting
46+
rejectUnauthorized: this.strictSSL, // strict ssl option
47+
headers: {
48+
"Proxy-Authorization": "Bearer authentication_token", // proxy authentification
49+
"Authorization": 'Basic ' + Buffer.from(username + ':' + password).toString('base64') // basic authentication
50+
},
51+
oauth: { // in the case of oauth instead of basic
52+
consumer_key: oauth.consumer_key,
53+
consumer_secret: oauth.consumer_secret,
54+
token: oauth.access_token,
55+
token_secret: oauth.access_token_secret
56+
}
57+
}
58+
JiraApiWithOptions = require('jira').JiraApiWithOptions;
59+
60+
var jira = new JiraApiWithOptions('https', 'server.com', '443', '2.0.alpha1', true, 'jira', options);
61+
62+
3663
### Find the status of an issue ###
3764

3865
jira.findIssue(issueNumber, function(error, issue) {

‎lib/jira.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@
4545
// token_secret: oauth.access_token_secret
4646
// }
4747
//}
48-
//JiraApi = require('jira').JiraApi;
48+
//JiraApiWithOptions = require('jira').JiraApiWithOptions;
4949
//
50-
//var jira = new JiraApi('https', 'server.com', '443', '2.0.alpha1', true, 'jira', options);
50+
//var jira = new JiraApiWithOptions('https', 'server.com', '443', '2.0.alpha1', true, 'jira', options);
5151
//jira.findIssue(issueNumber, function(error, issue) {
5252
// console.log('Status: ' + issue.fields.status.name);
5353
//});

0 commit comments

Comments
 (0)
Please sign in to comment.