Skip to content

Commit dab7205

Browse files
committed
Work when self-signed cert is being accepted
1 parent 22e7014 commit dab7205

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/makeRESTRequest.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import axiosCookieJarSupport from "axios-cookiejar-support";
33
import tough = require("tough-cookie");
44
import * as vscode from "vscode";
55
import { IServerSpec } from "./extension";
6+
import * as https from 'https';
67

78
const AUTHENTICATION_PROVIDER = "intersystems-server-credentials";
89

@@ -34,6 +35,9 @@ export async function makeRESTRequest(
3435
data?: any,
3536
): Promise<AxiosResponse | undefined> {
3637

38+
// Create the HTTPS agent
39+
const httpsAgent = new https.Agent({ rejectUnauthorized: vscode.workspace.getConfiguration("http").get("proxyStrictSSL") });
40+
3741
// Build the URL
3842
let url = server.webServer.scheme + "://" + server.webServer.host + ":" + String(server.webServer.port);
3943
const pathPrefix = server.webServer.pathPrefix;
@@ -52,6 +56,7 @@ export async function makeRESTRequest(
5256
// There is a data payload
5357
respdata = await axios.request(
5458
{
59+
httpsAgent,
5560
data,
5661
headers: {
5762
"Content-Type": "application/json",
@@ -72,6 +77,7 @@ export async function makeRESTRequest(
7277
// Either we had no cookies or they expired, so resend the request with basic auth
7378
respdata = await axios.request(
7479
{
80+
httpsAgent,
7581
auth: {
7682
password: server.password,
7783
username: server.username,
@@ -92,6 +98,7 @@ export async function makeRESTRequest(
9298
// No data payload
9399
respdata = await axios.request(
94100
{
101+
httpsAgent,
95102
jar: cookieJar,
96103
method,
97104
url: encodeURI(url),
@@ -108,6 +115,7 @@ export async function makeRESTRequest(
108115
// Either we had no cookies or they expired, so resend the request with basic auth
109116
respdata = await axios.request(
110117
{
118+
httpsAgent,
111119
auth: {
112120
password: server.password,
113121
username: server.username,

0 commit comments

Comments
 (0)