Skip to content

Commit b43f650

Browse files
committed
replaced uri auth with header auth
1 parent 028b24f commit b43f650

File tree

2 files changed

+92
-26
lines changed

2 files changed

+92
-26
lines changed

lib/jira.js

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,20 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
153153
var uri = url.format({
154154
protocol: this.protocol,
155155
hostname: this.host,
156-
auth: this.username + ':' + this.password,
157156
port: this.port,
158157
pathname: basePath + this.apiVersion + pathname
159158
});
160159
return decodeURIComponent(uri);
161160
};
162161

162+
this.doRequest = function(options, callback) {
163+
options.auth = {
164+
'user': this.username,
165+
'pass': this.password
166+
};
167+
168+
this.request(options, callback);
169+
};
163170

164171
};
165172

@@ -184,7 +191,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
184191
method: 'GET'
185192
};
186193

187-
this.request(options, function(error, response, body) {
194+
this.doRequest(options, function(error, response, body) {
188195

189196
if (error) {
190197
callback(error, null);
@@ -229,7 +236,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
229236
method: 'GET'
230237
};
231238

232-
this.request(options, function(error, response, body) {
239+
this.doRequest(options, function(error, response, body) {
233240

234241
if (error) {
235242
callback(error, null);
@@ -272,7 +279,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
272279
method: 'GET'
273280
};
274281

275-
this.request(options, function(error, response, body) {
282+
this.doRequest(options, function(error, response, body) {
276283

277284
if (error) {
278285
callback(error, null);
@@ -320,7 +327,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
320327
json: true
321328
};
322329

323-
this.request(options, function(error, response) {
330+
this.doRequest(options, function(error, response) {
324331

325332
if (error) {
326333
callback(error, null);
@@ -375,7 +382,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
375382
json:true
376383
};
377384

378-
this.request(options, function(error, response) {
385+
this.doRequest(options, function(error, response) {
379386

380387
if (error) {
381388
callback(error, null);
@@ -428,7 +435,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
428435
json: true
429436
};
430437

431-
this.request(options, function(error, response) {
438+
this.doRequest(options, function(error, response) {
432439

433440
if (error) {
434441
callback(error, null);
@@ -490,7 +497,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
490497

491498
logger.log(options.uri);
492499

493-
this.request(options, function(error, response) {
500+
this.doRequest(options, function(error, response) {
494501

495502
if (error) {
496503
callback(error, null);
@@ -551,7 +558,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
551558
body: link
552559
};
553560

554-
this.request(options, function(error, response) {
561+
this.doRequest(options, function(error, response) {
555562

556563
if (error) {
557564
callback(error, null);
@@ -592,7 +599,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
592599
method: 'GET'
593600
};
594601

595-
this.request(options, function(error, response, body) {
602+
this.doRequest(options, function(error, response, body) {
596603

597604
if (error) {
598605
callback(error, null);
@@ -648,7 +655,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
648655
json: true,
649656
body: version
650657
};
651-
this.request(options, function(error, response, body) {
658+
this.doRequest(options, function(error, response, body) {
652659

653660
if (error) {
654661
callback(error, null);
@@ -717,7 +724,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
717724
}
718725
};
719726

720-
this.request(options, function(error, response, body) {
727+
this.doRequest(options, function(error, response, body) {
721728

722729
if (error) {
723730
callback(error, null);
@@ -775,7 +782,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
775782
followAllRedirects: true
776783
};
777784

778-
this.request(options, function(error, response, body) {
785+
this.doRequest(options, function(error, response, body) {
779786

780787
if (error) {
781788
callback(error, null);
@@ -839,7 +846,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
839846
body: issue
840847
};
841848

842-
this.request(options, function(error, response, body) {
849+
this.doRequest(options, function(error, response, body) {
843850

844851
if (error) {
845852
callback(error, null);
@@ -880,7 +887,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
880887
json: true
881888
};
882889

883-
this.request(options, function(error, response) {
890+
this.doRequest(options, function(error, response) {
884891

885892
if (error) {
886893
callback(error, null);
@@ -918,7 +925,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
918925
json: true
919926
};
920927

921-
this.request(options, function(error, response) {
928+
this.doRequest(options, function(error, response) {
922929

923930
if (error) {
924931
callback(error, null);
@@ -977,7 +984,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
977984
json: true
978985
};
979986

980-
this.request(options, function(error, response, body) {
987+
this.doRequest(options, function(error, response, body) {
981988

982989
if (error) {
983990
callback(error, null);
@@ -1030,7 +1037,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
10301037
json: true
10311038
};
10321039

1033-
this.request(options, function(error, response, body) {
1040+
this.doRequest(options, function(error, response, body) {
10341041

10351042
if (error) {
10361043
callback(error, null);
@@ -1078,7 +1085,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
10781085
json: true
10791086
};
10801087

1081-
this.request(options, function(error, response, body) {
1088+
this.doRequest(options, function(error, response, body) {
10821089

10831090
if (error) {
10841091
callback(error, null);
@@ -1155,7 +1162,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
11551162
json: true
11561163
};
11571164

1158-
this.request(options, function(error, response, body) {
1165+
this.doRequest(options, function(error, response, body) {
11591166

11601167
if (error) {
11611168
callback(error, null);
@@ -1197,7 +1204,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
11971204
json: true
11981205
};
11991206

1200-
this.request(options, function(error, response) {
1207+
this.doRequest(options, function(error, response) {
12011208

12021209
if (error) {
12031210
callback(error, null);
@@ -1245,7 +1252,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
12451252
json: true
12461253
};
12471254

1248-
this.request(options, function(error, response, body) {
1255+
this.doRequest(options, function(error, response, body) {
12491256

12501257
if (error) {
12511258
callback(error, null);
@@ -1288,7 +1295,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
12881295
json: true
12891296
};
12901297

1291-
this.request(options, function(error, response, body) {
1298+
this.doRequest(options, function(error, response, body) {
12921299
if (error) {
12931300
callback(error, null);
12941301
return;
@@ -1353,7 +1360,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
13531360
json: true
13541361
};
13551362

1356-
this.request(options, function(error, response, body) {
1363+
this.doRequest(options, function(error, response, body) {
13571364

13581365
if (error) {
13591366
callback(error, null);
@@ -1406,7 +1413,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
14061413
json: true
14071414
};
14081415

1409-
this.request(options, function(error, response, body) {
1416+
this.doRequest(options, function(error, response, body) {
14101417

14111418
if (error) {
14121419
callback(error, null);

0 commit comments

Comments
 (0)