@@ -92,13 +92,19 @@ var url = require('url'),
92
92
logger = console ;
93
93
94
94
95
- var JiraApi = exports . JiraApi = function ( protocol , host , port , username , password , apiVersion , verbose ) {
95
+ var JiraApi = exports . JiraApi = function ( protocol , host , port , username , password , apiVersion , verbose , strictSSL ) {
96
96
this . protocol = protocol ;
97
97
this . host = host ;
98
98
this . port = port ;
99
99
this . username = username ;
100
100
this . password = password ;
101
101
this . apiVersion = apiVersion ;
102
+ // Default strictSSL to true (previous behavior) but now allow it to be
103
+ // modified
104
+ if ( strictSSL == null ) {
105
+ strictSSL = true ;
106
+ }
107
+ this . strictSSL = strictSSL ;
102
108
// This is so we can fake during unit tests
103
109
this . request = require ( 'request' ) ;
104
110
if ( verbose !== true ) { logger = { log : function ( ) { } } ; }
@@ -140,6 +146,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
140
146
this . findIssue = function ( issueNumber , callback ) {
141
147
142
148
var options = {
149
+ rejectUnauthorized : this . strictSSL ,
143
150
uri : this . makeUri ( '/issue/' + issueNumber ) ,
144
151
method : 'GET'
145
152
} ;
@@ -180,6 +187,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
180
187
181
188
this . getUnresolvedIssueCount = function ( version , callback ) {
182
189
var options = {
190
+ rejectUnauthorized : this . strictSSL ,
183
191
uri : this . makeUri ( '/version/' + version + '/unresolvedIssueCount' ) ,
184
192
method : 'GET'
185
193
} ;
@@ -222,6 +230,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
222
230
this . getProject = function ( project , callback ) {
223
231
224
232
var options = {
233
+ rejectUnauthorized : this . strictSSL ,
225
234
uri : this . makeUri ( '/project/' + project ) ,
226
235
method : 'GET'
227
236
} ;
@@ -268,6 +277,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
268
277
this . findRapidView = function ( projectName , callback ) {
269
278
270
279
var options = {
280
+ rejectUnauthorized : this . strictSSL ,
271
281
uri : this . makeUri ( '/rapidviews/list' , 'rest/greenhopper/' ) ,
272
282
method : 'GET' ,
273
283
json : true
@@ -322,6 +332,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
322
332
this . getLastSprintForRapidView = function ( rapidViewId , callback ) {
323
333
324
334
var options = {
335
+ rejectUnauthorized : this . strictSSL ,
325
336
uri : this . makeUri ( '/sprints/' + rapidViewId , 'rest/greenhopper/' ) ,
326
337
method : 'GET' ,
327
338
json :true
@@ -374,6 +385,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
374
385
this . getSprintIssues = function getSprintIssues ( rapidViewId , sprintId , callback ) {
375
386
376
387
var options = {
388
+ rejectUnauthorized : this . strictSSL ,
377
389
uri : this . makeUri ( '/rapid/charts/sprintreport?rapidViewId=' + rapidViewId + '&sprintId=' + sprintId , 'rest/greenhopper/' ) ,
378
390
method : 'GET' ,
379
391
json : true
@@ -429,6 +441,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
429
441
this . addIssueToSprint = function ( issueId , sprintId , callback ) {
430
442
431
443
var options = {
444
+ rejectUnauthorized : this . strictSSL ,
432
445
uri : this . makeUri ( '/sprint/' + sprintId + '/issues/add' , 'rest/greenhopper/' ) ,
433
446
method : 'PUT' ,
434
447
followAllRedirects : true ,
@@ -493,6 +506,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
493
506
this . issueLink = function ( link , callback ) {
494
507
495
508
var options = {
509
+ rejectUnauthorized : this . strictSSL ,
496
510
uri : this . makeUri ( '/issueLink' ) ,
497
511
method : 'POST' ,
498
512
followAllRedirects : true ,
@@ -536,6 +550,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
536
550
this . getVersions = function ( project , callback ) {
537
551
538
552
var options = {
553
+ rejectUnauthorized : this . strictSSL ,
539
554
uri : this . makeUri ( '/project/' + project + '/versions' ) ,
540
555
method : 'GET'
541
556
} ;
@@ -589,6 +604,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
589
604
this . createVersion = function ( version , callback ) {
590
605
591
606
var options = {
607
+ rejectUnauthorized : this . strictSSL ,
592
608
uri : this . makeUri ( '/version' ) ,
593
609
method : 'POST' ,
594
610
followAllRedirects : true ,
@@ -651,6 +667,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
651
667
}
652
668
653
669
var options = {
670
+ rejectUnauthorized : this . strictSSL ,
654
671
uri : this . makeUri ( '/search' ) ,
655
672
method : 'POST' ,
656
673
json : true ,
@@ -719,6 +736,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
719
736
// [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id290028)
720
737
this . addNewIssue = function ( issue , callback ) {
721
738
var options = {
739
+ rejectUnauthorized : this . strictSSL ,
722
740
uri : this . makeUri ( '/issue' ) ,
723
741
method : 'POST' ,
724
742
followAllRedirects : true ,
@@ -760,6 +778,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
760
778
// [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id290791)
761
779
this . deleteIssue = function ( issueNum , callback ) {
762
780
var options = {
781
+ rejectUnauthorized : this . strictSSL ,
763
782
uri : this . makeUri ( '/issue/' + issueNum ) ,
764
783
method : 'DELETE' ,
765
784
followAllRedirects : true ,
@@ -796,6 +815,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
796
815
// [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id290878)
797
816
this . updateIssue = function ( issueNum , issueUpdate , callback ) {
798
817
var options = {
818
+ rejectUnauthorized : this . strictSSL ,
799
819
uri : this . makeUri ( '/issue/' + issueNum ) ,
800
820
body : issueUpdate ,
801
821
method : 'PUT' ,
@@ -869,6 +889,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
869
889
*/
870
890
this . listTransitions = function ( issueId , callback ) {
871
891
var options = {
892
+ rejectUnauthorized : this . strictSSL ,
872
893
uri : this . makeUri ( '/issue/' + issueId + '/transitions' ) ,
873
894
method : 'GET' ,
874
895
json : true
@@ -908,6 +929,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
908
929
// [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id290489)
909
930
this . transitionIssue = function ( issueNum , issueTransition , callback ) {
910
931
var options = {
932
+ rejectUnauthorized : this . strictSSL ,
911
933
uri : this . makeUri ( '/issue/' + issueNum + '/transitions' ) ,
912
934
body : issueTransition ,
913
935
method : 'POST' ,
@@ -957,6 +979,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
957
979
*/
958
980
this . listProjects = function ( callback ) {
959
981
var options = {
982
+ rejectUnauthorized : this . strictSSL ,
960
983
uri : this . makeUri ( '/project' ) ,
961
984
method : 'GET' ,
962
985
json : true
@@ -1022,6 +1045,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
1022
1045
*/
1023
1046
this . addWorklog = function ( issueId , worklog , callback ) {
1024
1047
var options = {
1048
+ rejectUnauthorized : this . strictSSL ,
1025
1049
uri : this . makeUri ( '/issue/' + issueId + '/worklog' ) ,
1026
1050
body : worklog ,
1027
1051
method : 'POST' ,
@@ -1076,6 +1100,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
1076
1100
*/
1077
1101
this . listIssueTypes = function ( callback ) {
1078
1102
var options = {
1103
+ rejectUnauthorized : this . strictSSL ,
1079
1104
uri : this . makeUri ( '/issuetype' ) ,
1080
1105
method : 'GET' ,
1081
1106
json : true
0 commit comments