Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
proxyConf.getProxyUrl(); // $ExpectType string
proxyConf.test("string"); // $ExpectType boolean
proxyConf.update(proxyConfDef); // $ExpectType void
proxyConf.updateProtocols(["string"]); // $ExpectType void
pmCollection.ProxyConfig.isProxyConfig(proxyConf); // $ExpectType boolean
// ProxyConfigList Tests
const proxyConfigList = new pmCollection.ProxyConfigList(null, [proxyConf]);
proxyConfigList.resolve("string"); // $ExpectType ProxyConfig
proxyConfigList.resolve(new pmCollection.Url({host: "string", path: "string"})); // $ExpectType ProxyConfig
pmCollection.ProxyConfigList.isProxyConfigList(proxyConfigList); // $ExpectType boolean
// QueryParamDefinition Tests
const qpDef: pmCollection.QueryParamDefinition = {
key: null,
value: null
};
qpDef.key; // $ExpectType string | null
qpDef.value; // $ExpectType string | null
qpDef.system; // $ExpectType boolean | undefined
// QueryParam Tests
let qp = new pmCollection.QueryParam("string");
host: ["string"],
path: ["string"]
};
urlDef.auth; // $ExpectType { user: string; password: string; } | undefined
urlDef.hash; // $ExpectType string | undefined
urlDef.host; // $ExpectType string | string[] | undefined
urlDef.path; // $ExpectType string | string[]
urlDef.port; // $ExpectType string | undefined
urlDef.query; // $ExpectType string | QueryParamDefinition[] | PropertyList | undefined
urlDef.variable; // $ExpectType VariableDefinition[] | undefined
urlDef.protocol; // $ExpectType string | undefined
// Url Tests
let url = new pmCollection.Url(urlDef);
url = new pmCollection.Url("string");
url.auth; // $ExpectType { user: string; password: string; } | undefined
url.hash; // $ExpectType string | undefined
url.host; // $ExpectType string[] | undefined
url.path; // $ExpectType string[]
url.port; // $ExpectType string | undefined
url.protocol; // $ExpectType string | undefined
url.query; // $ExpectType PropertyList
url.variables; // $ExpectType VariableList
url.addQueryParams("string"); // $ExpectType void
url.addQueryParams([qp, qpDef]); // $ExpectType void
url.removeQueryParams("string"); // $ExpectType void
url.removeQueryParams(["string"]); // $ExpectType void
// CertificateDefinition Tests
const certDef: pmCollection.CertificateDefinition = {};
certDef.matches; // $ExpectType string[] | UrlMatchPatternList | undefined
certDef.key; // $ExpectType string | { src?: string | undefined; } | undefined
certDef.cert; // $ExpectType string | { src?: string | undefined; } | undefined
certDef.passphrase; // $ExpectType string | undefined
// Certificate Tests
const certificate = new pmCollection.Certificate({});
certificate.cert; // $ExpectType { src?: string | undefined; }
certificate.key; // $ExpectType { src?: string | undefined; }
certificate.matches; // $ExpectType UrlMatchPatternList
certificate.passphrase; // $ExpectType string
certificate.canApplyTo("string"); // $ExpectType boolean
certificate.canApplyTo(new pmCollection.Url({host: "string", path: "string"})); // $ExpectType boolean
certificate.update({}); // $ExpectType void
pmCollection.Certificate.isCertificate(certificate); // $ExpectType boolean
// PropertyList Tests
const pList = new pmCollection.PropertyList("Certificate", null, []);
pList.add(certificate); // $ExpectType void
pList.all(); // $ExpectType Certificate[]
pList.append(certificate); // $ExpectType void
pList.assimilate(pList, false); // $ExpectType void
pList.assimilate([certificate], false); // ExpectType void
pList.clear(); // $ExpectType void
pList.count(); // $ExpectType number
pList.each((el: pmCollection.Certificate) => {}); // $ExpectType void
pList.each((el: pmCollection.Certificate) => {}, pList); // $ExpectType void
path: ["string"]
};
urlDef.auth; // $ExpectType { user: string; password: string; } | undefined
urlDef.hash; // $ExpectType string | undefined
urlDef.host; // $ExpectType string | string[] | undefined
urlDef.path; // $ExpectType string | string[]
urlDef.port; // $ExpectType string | undefined
urlDef.query; // $ExpectType string | QueryParamDefinition[] | PropertyList | undefined
urlDef.variable; // $ExpectType VariableDefinition[] | undefined
urlDef.protocol; // $ExpectType string | undefined
// Url Tests
let url = new pmCollection.Url(urlDef);
url = new pmCollection.Url("string");
url.auth; // $ExpectType { user: string; password: string; } | undefined
url.hash; // $ExpectType string | undefined
url.host; // $ExpectType string[] | undefined
url.path; // $ExpectType string[]
url.port; // $ExpectType string | undefined
url.protocol; // $ExpectType string | undefined
url.query; // $ExpectType PropertyList
url.variables; // $ExpectType VariableList
url.addQueryParams("string"); // $ExpectType void
url.addQueryParams([qp, qpDef]); // $ExpectType void
url.removeQueryParams("string"); // $ExpectType void
url.removeQueryParams(["string"]); // $ExpectType void
url.removeQueryParams(qp); // $ExpectType void
'headersToSign'
]),
url = urlEncoder.toNodeUrl(request.url.toString(true)),
self = this;
if (!(params.accessToken && params.clientToken && params.clientSecret)) {
return done(); // Nothing to do if required parameters are not present.
}
request.removeHeader(AUTHORIZATION, {ignoreCase: true});
// Extract host from provided baseURL.
// @note: Here, instead of directly passing params.baseURL in urlEncoder.toNodeUrl() we first parse it using
// sdk.Url() and add protocol because urlEncoder.toNodeUrl() method doesn't work properly with URLs
// without protocol
params.baseURL = params.baseURL && urlEncoder.toNodeUrl(new sdk.Url(params.baseURL).toString(true)).host;
params.nonce = params.nonce || uuid();
params.timestamp = params.timestamp || getTimestamp();
params.url = url;
params.method = request.method;
// ensure that headers are case-insensitive as specified in the documentation
params.headers = request.getHeaders({enabled: true, ignoreCase: true});
if (typeof params.headersToSign === STRING) {
params.headersToSign = params.headersToSign.split(',');
}
else if (!_.isArray(params.headersToSign)) {
params.headersToSign = [];
}
// only calculate body hash for POST requests according to specification
async.map(transactions, (transaction, requestCallback) => {
let requestUrl = transaction.request.url,
matchedPaths;
if (typeof requestUrl === 'object') {
// SDK URL object. Get raw string representation.
requestUrl = (new sdk.Url(requestUrl)).toString();
}
// 1. Look at transaction.request.URL + method, and find matching request from schema
matchedPaths = schemaUtils.findMatchingRequestFromSchema(
transaction.request.method,
requestUrl,
schema
);
if (!matchedPaths.length) {
// No matching paths found
return requestCallback(null, {
requestId: transaction.id,
endpoints: []
});
}
payload.data,
payload.environment.values,
payload.collectionVariables.values,
payload.globals.values
],
item,
auth;
// @todo - no need to sync variables when SDK starts supporting resolution from scope directly
item = context.item = new sdk.Item(context.item.toObjectResolved(null,
variableDefinitions, {ignoreOwnVariables: true}));
auth = context.auth;
// Re-parse the URL, because variables have been resolved now, and things might be moved around
item.request.url = new (sdk.Url)(item.request.url.toString());
// resolve variables in auth
auth && (context.auth = new sdk.RequestAuth(auth.toObjectResolved(null,
variableDefinitions, {ignoreOwnVariables: true})));
};
sanitizeURL = function (url) {
if (Url.isUrl(url)) {
return url;
}
if (url && typeof url === STRING) {
return new Url(url);
}
return null;
},