Skip to content

Commit 01a2ce2

Browse files
jetersenjdalrymple
authored andcommitted
feat: Expose reject unauthorized in request helper (#160)
Allows to be set service wide or on individual request fixes #142
1 parent 77244c6 commit 01a2ce2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/infrastructure/BaseService.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ class BaseModel {
99
url = 'https://gitlab.com',
1010
useXMLHttpRequest = false,
1111
version = 'v4',
12+
rejectUnauthorized = true,
1213
} = {}) {
1314
this.url = URLJoin(url, 'api', version);
1415
this.headers = {};
1516
this.requester = useXMLHttpRequest ? XMLHttpRequester : Request;
1617
this.useXMLHttpRequest = useXMLHttpRequest;
18+
this.rejectUnauthorized = rejectUnauthorized;
1719

1820
if (oauthToken) {
1921
this.headers.authorization = `Bearer ${oauthToken}`;

src/infrastructure/RequestHelper.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import URLJoin from 'url-join';
55
import StreamableRequest from 'request';
66

77
function defaultRequest(
8-
{ url, useXMLHttpRequest },
8+
{ url, useXMLHttpRequest, rejectUnauthorized },
99
endpoint,
1010
{
1111
headers,
@@ -36,6 +36,8 @@ function defaultRequest(
3636

3737
params.resolveWithFullResponse = resolveWithFullResponse;
3838

39+
params.rejectUnauthorized = rejectUnauthorized;
40+
3941
return params;
4042
}
4143

0 commit comments

Comments
 (0)