Skip to content

Commit 37d1a67

Browse files
committed
fix: try to fix problem with http + disableStrictSSL
1 parent 0c1baf8 commit 37d1a67

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/util/request.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
const _ = require("lodash");
12
const https = require("https");
3+
const http = require("http");
24
const fetch = require("node-fetch-h2");
35

46
class Request {
@@ -18,7 +20,7 @@ class Request {
1820

1921
/**
2022
*
21-
* @param url
23+
* @param url {string}
2224
* @param disableStrictSSL
2325
* @param authToken
2426
* @param options {Partial<import("node-fetch").RequestInit>}
@@ -33,7 +35,8 @@ class Request {
3335
};
3436

3537
if (disableStrictSSL) {
36-
requestOptions.agent = new https.Agent({
38+
const { Agent } = _.startsWith(url, "http://") ? http : https;
39+
requestOptions.agent = new Agent({
3740
rejectUnauthorized: false,
3841
});
3942
}

0 commit comments

Comments
 (0)