feat(#946): Fix PR #1070 - Add feature to CLI & prepend 'http://' to URL after interpolation

This commit is contained in:
Nelu Platonov
2023-11-30 01:16:37 +01:00
parent bb852c5f80
commit d0f858681d
5 changed files with 28 additions and 20 deletions

View File

@@ -17,6 +17,8 @@ const { SocksProxyAgent } = require('socks-proxy-agent');
const { makeAxiosInstance } = require('../utils/axios-instance');
const { shouldUseProxy, PatchedHttpsProxyAgent } = require('../utils/proxy-util');
const protocolRegex = /([a-zA-Z]{2,20}:\/\/)(.*)/;
const runSingleRequest = async function (
filename,
bruJson,
@@ -81,6 +83,10 @@ const runSingleRequest = async function (
// interpolate variables inside request
interpolateVars(request, envVariables, collectionVariables, processEnvVars);
if (!protocolRegex.test(request.url)) {
request.url = `http://${request.url}`;
}
const options = getOptions();
const insecure = get(options, 'insecure', false);
const httpsAgentRequestFields = {};